Skip to content

Instantly share code, notes, and snippets.

@drawers
Created January 21, 2021 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawers/462439de70a8970adf8caa68d271f909 to your computer and use it in GitHub Desktop.
Save drawers/462439de70a8970adf8caa68d271f909 to your computer and use it in GitHub Desktop.
Extracting a separate
// data layer object
open class RealmTask constructor(
var title: String = "",
var description: String,
var isCompleted: Boolean,
@PrimaryKey var entryId: String
): RealmObject()
fun RealmTask.toDomain() {
return Task(
title = this.title,
description = this.description,
isCompleted = this.isCompleted,
entryId = this.entryId
)
}
// domain layer object
data class Task(
val title: String,
val description: String,
val isCompleted: Boolean,
val entryId: String
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment