} val androidMain by getting { dependencies { implementation( "androidx.work:work-runtime-ktx:$work_version") } } val iosMain by getting } } val commonTest by getting val androidTest by getting val iosTest by getting
fun main() { val data = User("Paolo", “[email protected]”) val serializedData: String = Json.encodeToString(data) println(serializedData) // {“name”:"Paolo","email":"[email protected]"} val deserializedData: User = Json.decodeFromString(serializedData) println(deserializedData) // Project(name=Paolo, [email protected]) }
todos = getTodoFromServer() saveToDb(todos) return todos } } TodoRepository().fetchTodo {todos, error in } func loadTodo() async throws { let todo = try await TodoRepository().fetchTodo() }
{ suspend fun fetchTodo(): List<Todo> { val todos = getTodoFromServer() saveToDb(todos) return todos } } @ExportedScopeProvider class MainScopeProvider : ScopeProvider { override val scope : CoroutineScope = MainScope() }
{ suspend fun fetchTodoList(): TodoList { val todos = getTodoFromServer() saveToDb(todos) return TodoList(todos) } } @ExportedScopeProvider class MainScopeProvider : ScopeProvider { override val scope : CoroutineScope = MainScope() } data class TodoList(val list: List<Todo>)