diff --git a/experimental/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj b/experimental/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj index db611b6470..8494f1218a 100644 --- a/experimental/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/experimental/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 2152FB042600AC8F00CF470E /* iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iosApp.swift */; }; C1FC908188C4E8695729CB06 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DE96E47030356CE6AD9794A /* Pods_iosApp.framework */; }; + D5DE79A846260A9C7654FCD6 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DE73F83209A8ECD8AB0ED9 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -19,6 +20,7 @@ 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DE96E47030356CE6AD9794A /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AB3632DC29227652001CCB65 /* TeamId.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = TeamId.xcconfig; sourceTree = ""; }; + D5DE73F83209A8ECD8AB0ED9 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -57,6 +59,7 @@ children = ( 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iosApp.swift */, + D5DE73F83209A8ECD8AB0ED9 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -199,6 +202,7 @@ buildActionMask = 2147483647; files = ( 2152FB042600AC8F00CF470E /* iosApp.swift in Sources */, + D5DE79A846260A9C7654FCD6 /* ContentView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/experimental/examples/imageviewer/iosApp/iosApp/ContentView.swift b/experimental/examples/imageviewer/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f7f6457b31 --- /dev/null +++ b/experimental/examples/imageviewer/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + + + diff --git a/experimental/examples/imageviewer/iosApp/iosApp/iosApp.swift b/experimental/examples/imageviewer/iosApp/iosApp/iosApp.swift index 0f563c50c9..927e0b97b8 100644 --- a/experimental/examples/imageviewer/iosApp/iosApp/iosApp.swift +++ b/experimental/examples/imageviewer/iosApp/iosApp/iosApp.swift @@ -1,15 +1,10 @@ -import UIKit -import shared +import SwiftUI @main -class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let mainViewController = Main_iosKt.MainViewController() - window?.rootViewController = mainViewController - window?.makeKeyAndVisible() - return true +struct iOSApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } } } diff --git a/experimental/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/main.ios.kt b/experimental/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/main.ios.kt index 200417490f..b477d563ee 100644 --- a/experimental/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/main.ios.kt +++ b/experimental/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/main.ios.kt @@ -10,12 +10,5 @@ import platform.UIKit.UIViewController fun MainViewController(): UIViewController = Application("Imageviewer") { - Column { - // To skip upper part of screen. - Box( - modifier = Modifier - .height(30.dp) - ) - ImageViewerIos() - } + ImageViewerIos() }