TodoMVC iOS
This is an example of real-time collaborative TodoMVC using Yorkie iOS SDK.
TodomvcApp.swift
1/*2 * Copyright 2025 The Yorkie Authors. All rights reserved.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617import SwiftUI1819@main20struct TodomvcApp: App {21 @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate22 @Environment(\.scenePhase) var scenePhase2324 @State var key = Constant.documentKey2526 var body: some Scene {27 WindowGroup {28 NavigationView {29 VStack {30 Text("Input document key or use the default")31 TextField(text: self.$key) {32 Text("Input documentKey")33 }3435 NavigationLink(destination: ContentView()) {36 Text("Go")37 }38 }39 .padding()40 }41 .navigationViewStyle(.stack)42 }.onChange(of: self.scenePhase) { newPhase in43 Log.log("[ChangePhase] -> \(newPhase)", level: .debug)44 }45 .onChange(of: self.key) { newValue in46 Constant.documentKey = newValue47 }48 }49}5051final class AppDelegate: NSObject, UIApplicationDelegate {52 func application(53 _: UIApplication,54 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil55 ) -> Bool {56 return true57 }58}