Rich Text Editor iOS
This is an example of real-time collaborative Rich Text Editor using Yorkie iOS SDK.
RichTextEditorApp.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 RichTextEditorApp: App {21 @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate22 @Environment(\.scenePhase) var scenePhase23 @State var key = Constant.documentKey2425 var body: some Scene {26 WindowGroup {27 NavigationView {28 VStack {29 Text("Input document key or use the default")30 TextField(text: self.$key) {31 Text("Input documentKey")32 }3334 NavigationLink(destination: ContentView()) {35 Text("Go")36 }37 }38 .padding()39 }40 .navigationViewStyle(.stack)41 }.onChange(of: self.scenePhase) { newPhase in42 Log.log("[ChangePhase] -> \(newPhase)", level: .debug)43 }44 .onChange(of: self.key) { newValue in45 Constant.documentKey = newValue46 }47 }48}4950final class AppDelegate: NSObject, UIApplicationDelegate {51 func application(52 _: UIApplication,53 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil54 ) -> Bool {55 return true56 }57}