From a013d73a67d7120a7b92a8d45f6d6f09c65cf86e Mon Sep 17 00:00:00 2001 From: "dima.avdeev" Date: Wed, 6 Sep 2023 19:32:24 +0300 Subject: [PATCH] iOS examples. Returned the ContentView back to how it was (#3633) --- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ examples/chat/iosApp/iosApp/ContentView.swift | 27 +++++++++++++ examples/chat/iosApp/iosApp/iOSApp.swift | 22 +---------- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 22 +++++++++++ .../iosApp/iosApp/iOSApp.swift | 16 +------- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 21 ++++++++++ .../codeviewer/iosApp/iosApp/iOSApp.swift | 15 +------- .../iosApp/iosApp/ContentView.swift | 17 ++++----- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 38 +++++++++++++++++++ .../imageviewer/iosApp/iosApp/iOSApp.swift | 33 +--------------- .../interop/ios-compose-in-swiftui/README.md | 2 +- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 17 +++++++++ .../iosApp/iosApp/iOSApp.swift | 12 +----- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 10 +++++ .../iosApp/iosApp/iOSApp.swift | 5 +-- .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 19 ++++++++++ .../iosApp/iosApp/iOSApp.swift | 14 +------ .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 20 ++++++++++ .../todoapp-lite/iosApp/iosApp/iOSApp.swift | 14 +------ .../iosApp/iosApp.xcodeproj/project.pbxproj | 4 ++ .../iosApp/iosApp/ContentView.swift | 19 ++++++++++ .../iosApp/iosApp/iOSApp.swift | 14 +------ 29 files changed, 246 insertions(+), 147 deletions(-) create mode 100644 examples/chat/iosApp/iosApp/ContentView.swift create mode 100644 examples/cocoapods-ios-example/iosApp/iosApp/ContentView.swift create mode 100644 examples/codeviewer/iosApp/iosApp/ContentView.swift create mode 100644 examples/imageviewer/iosApp/iosApp/ContentView.swift create mode 100644 examples/interop/ios-compose-in-swiftui/iosApp/iosApp/ContentView.swift create mode 100644 examples/interop/ios-swiftui-in-compose/iosApp/iosApp/ContentView.swift create mode 100644 examples/interop/ios-uikit-in-compose/iosApp/iosApp/ContentView.swift create mode 100644 examples/todoapp-lite/iosApp/iosApp/ContentView.swift create mode 100644 examples/widgets-gallery/iosApp/iosApp/ContentView.swift diff --git a/examples/chat/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/chat/iosApp/iosApp.xcodeproj/project.pbxproj index 98d28b8f43..2e6d3f51bb 100644 --- a/examples/chat/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/chat/iosApp/iosApp.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 1848823F43E447F9A8B4AC7C /* YetAnotherSwiftUIScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18488451271FAAD8FA34A2FB /* YetAnotherSwiftUIScreen.swift */; }; 184882D8AF2A7A3642004010 /* ComposeInsideSwiftUIScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18488CAB0978B80826E5BBB4 /* ComposeInsideSwiftUIScreen.swift */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1342AA8C2AA001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1332AA8C2AA001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ 18488CAB0978B80826E5BBB4 /* ComposeInsideSwiftUIScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComposeInsideSwiftUIScreen.swift; sourceTree = ""; }; 18488D89B8500CD7696A04EB /* KotlinToSwiftHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KotlinToSwiftHelper.swift; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1332AA8C2AA001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* Chat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Chat.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -65,6 +67,7 @@ 18488CAB0978B80826E5BBB4 /* ComposeInsideSwiftUIScreen.swift */, 18488451271FAAD8FA34A2FB /* YetAnotherSwiftUIScreen.swift */, 1848892FA748717E4087E7D7 /* GradientTemplate.swift */, + 3251B1332AA8C2AA001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -169,6 +172,7 @@ files = ( 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 1848810122D49D4AD3668D91 /* ComposeViewControllerToSwiftUI.swift in Sources */, + 3251B1342AA8C2AA001521C0 /* ContentView.swift in Sources */, 184880BA0E9910C2B5012412 /* KotlinToSwiftHelper.swift in Sources */, 184882D8AF2A7A3642004010 /* ComposeInsideSwiftUIScreen.swift in Sources */, 1848823F43E447F9A8B4AC7C /* YetAnotherSwiftUIScreen.swift in Sources */, diff --git a/examples/chat/iosApp/iosApp/ContentView.swift b/examples/chat/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..5b1a5fb43a --- /dev/null +++ b/examples/chat/iosApp/iosApp/ContentView.swift @@ -0,0 +1,27 @@ +import SwiftUI + +struct ContentView: View { + var body: some View { + TabView { + ComposeInsideSwiftUIScreen() + .tabItem { + Label("Group Chat", systemImage: "rectangle.3.group.bubble.left") + } + + YetAnotherSwiftUIScreen() + .tabItem { + Label("Settings", systemImage: "gear") + } + + } + .accentColor(Color(red: 0.671, green: 0.365, blue: 0.792)).preferredColorScheme(.light) + } +} + +let gradient = LinearGradient( + colors: [ + Color(red: 0.933, green: 0.937, blue: 0.953), + Color(red: 0.902, green: 0.941, blue: 0.949) + ], + startPoint: .topLeading, endPoint: .bottomTrailing +) diff --git a/examples/chat/iosApp/iosApp/iOSApp.swift b/examples/chat/iosApp/iosApp/iOSApp.swift index 66517720be..927e0b97b8 100644 --- a/examples/chat/iosApp/iosApp/iOSApp.swift +++ b/examples/chat/iosApp/iosApp/iOSApp.swift @@ -1,30 +1,10 @@ import SwiftUI -let gradient = LinearGradient( - colors: [ - Color(red: 0.933, green: 0.937, blue: 0.953), - Color(red: 0.902, green: 0.941, blue: 0.949) - ], - startPoint: .topLeading, endPoint: .bottomTrailing -) - @main struct iOSApp: App { var body: some Scene { WindowGroup { - TabView { - ComposeInsideSwiftUIScreen() - .tabItem { - Label("Group Chat", systemImage: "rectangle.3.group.bubble.left") - } - - YetAnotherSwiftUIScreen() - .tabItem { - Label("Settings", systemImage: "gear") - } - - } - .accentColor(Color(red: 0.671, green: 0.365, blue: 0.792)).preferredColorScheme(.light) + ContentView() } } } diff --git a/examples/cocoapods-ios-example/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/cocoapods-ios-example/iosApp/iosApp.xcodeproj/project.pbxproj index 6ff871146f..6b5ece3be0 100644 --- a/examples/cocoapods-ios-example/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/cocoapods-ios-example/iosApp/iosApp.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1362AA8C336001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1352AA8C336001521C0 /* ContentView.swift */; }; CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; /* End PBXBuildFile section */ @@ -17,6 +18,7 @@ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1352AA8C336001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF7B242A565900829871 /* My application.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My application.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -79,6 +81,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, + 3251B1352AA8C336001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -214,6 +217,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B1362AA8C336001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/cocoapods-ios-example/iosApp/iosApp/ContentView.swift b/examples/cocoapods-ios-example/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..6dd3d9342f --- /dev/null +++ b/examples/cocoapods-ios-example/iosApp/iosApp/ContentView.swift @@ -0,0 +1,22 @@ +import UIKit +import SwiftUI +import shared + + +struct ContentView: View { + var body: some View { + ZStack { + Color.white.ignoresSafeArea(.all) // status bar color + ComposeView() + .ignoresSafeArea(.all, edges: .bottom) // Compose has own keyboard handler + }.preferredColorScheme(.light) + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} diff --git a/examples/cocoapods-ios-example/iosApp/iosApp/iOSApp.swift b/examples/cocoapods-ios-example/iosApp/iosApp/iOSApp.swift index 063945cdc3..927e0b97b8 100644 --- a/examples/cocoapods-ios-example/iosApp/iosApp/iOSApp.swift +++ b/examples/cocoapods-ios-example/iosApp/iosApp/iOSApp.swift @@ -1,24 +1,10 @@ -import UIKit import SwiftUI -import shared @main struct iOSApp: App { var body: some Scene { WindowGroup { - ZStack { - Color.white.ignoresSafeArea(.all) // status bar color - ComposeView() - .ignoresSafeArea(.all, edges: .bottom) // Compose has own keyboard handler - }.preferredColorScheme(.light) + ContentView() } } } - -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - Main_iosKt.MainViewController() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} -} diff --git a/examples/codeviewer/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/codeviewer/iosApp/iosApp.xcodeproj/project.pbxproj index b11460f555..b2916a6c39 100644 --- a/examples/codeviewer/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/codeviewer/iosApp/iosApp.xcodeproj/project.pbxproj @@ -10,12 +10,14 @@ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1382AA8CF70001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1372AA8CF70001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1372AA8CF70001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* Codeviewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Codeviewer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -64,6 +66,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, + 3251B1372AA8CF70001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -168,6 +171,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B1382AA8CF70001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/codeviewer/iosApp/iosApp/ContentView.swift b/examples/codeviewer/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..fba41fb93c --- /dev/null +++ b/examples/codeviewer/iosApp/iosApp/ContentView.swift @@ -0,0 +1,21 @@ +import UIKit +import SwiftUI +import shared + +struct ContentView: View { + var body: some View { + ZStack { + Color(#colorLiteral(red: 0.235, green: 0.247, blue: 0.255, alpha: 1)).ignoresSafeArea(.all) + ComposeView() + .ignoresSafeArea(.all, edges: .bottom) // Compose has own keyboard handler + }.preferredColorScheme(.dark) + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} diff --git a/examples/codeviewer/iosApp/iosApp/iOSApp.swift b/examples/codeviewer/iosApp/iosApp/iOSApp.swift index 2a1d6e105b..15cbe525fa 100644 --- a/examples/codeviewer/iosApp/iosApp/iOSApp.swift +++ b/examples/codeviewer/iosApp/iosApp/iOSApp.swift @@ -1,24 +1,11 @@ -import UIKit import SwiftUI -import shared @main struct iOSApp: App { var body: some Scene { WindowGroup { - ZStack { - Color(#colorLiteral(red: 0.235, green: 0.247, blue: 0.255, alpha: 1)).ignoresSafeArea(.all) - ComposeView() - .ignoresSafeArea(.all, edges: .bottom) // Compose has own keyboard handler - }.preferredColorScheme(.dark) + ContentView() } } } -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - Main_iosKt.MainViewController() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} -} diff --git a/examples/falling-balls/iosApp/iosApp/ContentView.swift b/examples/falling-balls/iosApp/iosApp/ContentView.swift index f7f6457b31..e9915e5fcf 100644 --- a/examples/falling-balls/iosApp/iosApp/ContentView.swift +++ b/examples/falling-balls/iosApp/iosApp/ContentView.swift @@ -2,20 +2,17 @@ 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 + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler } } +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } - + func updateUIViewController(_ uiViewController: UIViewController, context: Context) {} +} diff --git a/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj index 6b01442206..9157644c9b 100644 --- a/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/imageviewer/iosApp/iosApp.xcodeproj/project.pbxproj @@ -10,12 +10,14 @@ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B13A2AA8D738001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1392AA8D738001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1392AA8D738001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* My Memories.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "My Memories.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -65,6 +67,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, + 3251B1392AA8D738001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -176,6 +179,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B13A2AA8D738001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/imageviewer/iosApp/iosApp/ContentView.swift b/examples/imageviewer/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..f02b93ebde --- /dev/null +++ b/examples/imageviewer/iosApp/iosApp/ContentView.swift @@ -0,0 +1,38 @@ +import UIKit +import SwiftUI +import shared + +struct ContentView: View { + var body: some View { + ZStack { + ComposeView() + .ignoresSafeArea(.all) // Compose has own keyboard handler + VStack { + gradient.ignoresSafeArea(edges: .top).frame(height: 0) + Spacer() + } + }.preferredColorScheme(.dark) + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + let controller = Main_iosKt.MainViewController() + controller.overrideUserInterfaceStyle = .light + return controller + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + } +} + +let gradient = LinearGradient( + colors: [ + Color.black.opacity(0.6), + Color.black.opacity(0.6), + Color.black.opacity(0.5), + Color.black.opacity(0.3), + Color.black.opacity(0.0), + ], + startPoint: .top, endPoint: .bottom +) diff --git a/examples/imageviewer/iosApp/iosApp/iOSApp.swift b/examples/imageviewer/iosApp/iosApp/iOSApp.swift index dfb369e039..927e0b97b8 100644 --- a/examples/imageviewer/iosApp/iosApp/iOSApp.swift +++ b/examples/imageviewer/iosApp/iosApp/iOSApp.swift @@ -1,41 +1,10 @@ -import UIKit import SwiftUI -import shared - -let gradient = LinearGradient( - colors: [ - Color.black.opacity(0.6), - Color.black.opacity(0.6), - Color.black.opacity(0.5), - Color.black.opacity(0.3), - Color.black.opacity(0.0), - ], - startPoint: .top, endPoint: .bottom -) @main struct iOSApp: App { var body: some Scene { WindowGroup { - ZStack { - ComposeView() - .ignoresSafeArea(.all) // Compose has own keyboard handler - VStack { - gradient.ignoresSafeArea(edges: .top).frame(height: 0) - Spacer() - } - }.preferredColorScheme(.dark) + ContentView() } } } - -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - let controller = Main_iosKt.MainViewController() - controller.overrideUserInterfaceStyle = .light - return controller - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) { - } -} diff --git a/examples/interop/ios-compose-in-swiftui/README.md b/examples/interop/ios-compose-in-swiftui/README.md index 710c14b48b..a7c7761e2b 100644 --- a/examples/interop/ios-compose-in-swiftui/README.md +++ b/examples/interop/ios-compose-in-swiftui/README.md @@ -2,7 +2,7 @@ This example shows how to use Compose inside an iOS Application written in SwiftUI. -Entry point is `struct iOSApp` in file [iosApp.swift](iosApp%2FiosApp%2FiosApp.swift). +Entry point is `struct ContentView` in file [ContentView.swift](iosApp%2FiosApp%2FContentView.swift). Compose entry point is `fun ComposeEntryPoint(): UIViewController` in file [main.ios.kt](shared%2Fsrc%2FiosMain%2Fkotlin%2Fmain.ios.kt). diff --git a/examples/interop/ios-compose-in-swiftui/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp.xcodeproj/project.pbxproj index bbff3905d0..78f1af53d1 100644 --- a/examples/interop/ios-compose-in-swiftui/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 1848823F43E447F9A8B4AC7C /* YetAnotherSwiftUIScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18488451271FAAD8FA34A2FB /* YetAnotherSwiftUIScreen.swift */; }; 184882D8AF2A7A3642004010 /* ComposeInSwiftUIScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18488CAB0978B80826E5BBB4 /* ComposeInSwiftUIScreen.swift */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B13C2AA8D8EC001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B13B2AA8D8EC001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -20,6 +21,7 @@ 1848892FA748717E4087E7D7 /* ScreenTemplate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenTemplate.swift; sourceTree = ""; }; 18488CAB0978B80826E5BBB4 /* ComposeInSwiftUIScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComposeInSwiftUIScreen.swift; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B13B2AA8D8EC001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* ComposeInSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ComposeInSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -62,6 +64,7 @@ 18488CAB0978B80826E5BBB4 /* ComposeInSwiftUIScreen.swift */, 18488451271FAAD8FA34A2FB /* YetAnotherSwiftUIScreen.swift */, 1848892FA748717E4087E7D7 /* ScreenTemplate.swift */, + 3251B13B2AA8D8EC001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -166,6 +169,7 @@ files = ( 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 1848810122D49D4AD3668D91 /* ComposeViewControllerInSwiftUI.swift in Sources */, + 3251B13C2AA8D8EC001521C0 /* ContentView.swift in Sources */, 184882D8AF2A7A3642004010 /* ComposeInSwiftUIScreen.swift in Sources */, 1848823F43E447F9A8B4AC7C /* YetAnotherSwiftUIScreen.swift in Sources */, 184881FBE98BA5BF02A0A186 /* ScreenTemplate.swift in Sources */, diff --git a/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/ContentView.swift b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..2023c2c7b1 --- /dev/null +++ b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/ContentView.swift @@ -0,0 +1,17 @@ +import SwiftUI + +struct ContentView: View { + var body: some View { + TabView { + ComposeInSwiftUIScreen() + .tabItem { + Label("Compose in SwiftUI", systemImage: "star.fill") + } + + YetAnotherSwiftUIScreen() + .tabItem { + Label("SwiftUI", systemImage: "gear") + } + } + } +} diff --git a/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/iOSApp.swift b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/iOSApp.swift index 4567acbc56..927e0b97b8 100644 --- a/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/iOSApp.swift +++ b/examples/interop/ios-compose-in-swiftui/iosApp/iosApp/iOSApp.swift @@ -4,17 +4,7 @@ import SwiftUI struct iOSApp: App { var body: some Scene { WindowGroup { - TabView { - ComposeInSwiftUIScreen() - .tabItem { - Label("Compose in SwiftUI", systemImage: "star.fill") - } - - YetAnotherSwiftUIScreen() - .tabItem { - Label("SwiftUI", systemImage: "gear") - } - } + ContentView() } } } diff --git a/examples/interop/ios-swiftui-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj index 246f0f5a9a..8ce409202c 100644 --- a/examples/interop/ios-swiftui-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj @@ -9,11 +9,13 @@ /* Begin PBXBuildFile section */ 1848810122D49D4AD3668D91 /* ComposeViewControllerRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18488656503C85EEDA66341D /* ComposeViewControllerRepresentable.swift */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B13E2AA8D9AE001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B13D2AA8D9AE001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 18488656503C85EEDA66341D /* ComposeViewControllerRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComposeViewControllerRepresentable.swift; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B13D2AA8D9AE001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* SwiftUIInCompose.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIInCompose.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -53,6 +55,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 18488656503C85EEDA66341D /* ComposeViewControllerRepresentable.swift */, + 3251B13D2AA8D9AE001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -157,6 +160,7 @@ files = ( 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, 1848810122D49D4AD3668D91 /* ComposeViewControllerRepresentable.swift in Sources */, + 3251B13E2AA8D9AE001521C0 /* ContentView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/ContentView.swift b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..007f79e0a5 --- /dev/null +++ b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/ContentView.swift @@ -0,0 +1,10 @@ +import SwiftUI +import shared +import UIKit + +struct ContentView: View { + var body: some View { + ComposeViewControllerRepresentable() + .ignoresSafeArea(.all) + } +} diff --git a/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/iOSApp.swift b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/iOSApp.swift index 840b083eee..927e0b97b8 100644 --- a/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/iOSApp.swift +++ b/examples/interop/ios-swiftui-in-compose/iosApp/iosApp/iOSApp.swift @@ -1,13 +1,10 @@ import SwiftUI -import shared -import UIKit @main struct iOSApp: App { var body: some Scene { WindowGroup { - ComposeViewControllerRepresentable() - .ignoresSafeArea(.all) + ContentView() } } } diff --git a/examples/interop/ios-uikit-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/interop/ios-uikit-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj index dda4ca8b86..feb3eb4322 100644 --- a/examples/interop/ios-uikit-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/interop/ios-uikit-in-compose/iosApp/iosApp.xcodeproj/project.pbxproj @@ -8,10 +8,12 @@ /* Begin PBXBuildFile section */ 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1402AA8DA8F001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B13F2AA8DA8F001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B13F2AA8DA8F001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* UIKitInCompose.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIKitInCompose.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -50,6 +52,7 @@ children = ( 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, + 3251B13F2AA8DA8F001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -152,6 +155,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B1402AA8DA8F001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/interop/ios-uikit-in-compose/iosApp/iosApp/ContentView.swift b/examples/interop/ios-uikit-in-compose/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..afb22de8c0 --- /dev/null +++ b/examples/interop/ios-uikit-in-compose/iosApp/iosApp/ContentView.swift @@ -0,0 +1,19 @@ +import SwiftUI +import shared +import UIKit + +struct ContentView: View { + var body: some View { + ComposeViewControllerToSwiftUI() + .ignoresSafeArea(.all) + } +} + +struct ComposeViewControllerToSwiftUI: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + return Main_iosKt.ComposeEntryPoint() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + } +} diff --git a/examples/interop/ios-uikit-in-compose/iosApp/iosApp/iOSApp.swift b/examples/interop/ios-uikit-in-compose/iosApp/iosApp/iOSApp.swift index 89d2827af1..927e0b97b8 100644 --- a/examples/interop/ios-uikit-in-compose/iosApp/iosApp/iOSApp.swift +++ b/examples/interop/ios-uikit-in-compose/iosApp/iosApp/iOSApp.swift @@ -1,22 +1,10 @@ import SwiftUI -import shared -import UIKit @main struct iOSApp: App { var body: some Scene { WindowGroup { - ComposeViewControllerToSwiftUI() - .ignoresSafeArea(.all) + ContentView() } } } - -struct ComposeViewControllerToSwiftUI: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - return Main_iosKt.ComposeEntryPoint() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) { - } -} diff --git a/examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj index 8dcd5224ec..45e9cdad0c 100644 --- a/examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/todoapp-lite/iosApp/iosApp.xcodeproj/project.pbxproj @@ -10,12 +10,14 @@ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1422AA8DC67001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1412AA8DC67001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1412AA8DC67001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* TodoAppLite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TodoAppLite.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -64,6 +66,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, + 3251B1412AA8DC67001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -168,6 +171,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B1422AA8DC67001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/todoapp-lite/iosApp/iosApp/ContentView.swift b/examples/todoapp-lite/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..9a63fa8f24 --- /dev/null +++ b/examples/todoapp-lite/iosApp/iosApp/ContentView.swift @@ -0,0 +1,20 @@ +import UIKit +import SwiftUI +import shared + + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + } +} diff --git a/examples/todoapp-lite/iosApp/iosApp/iOSApp.swift b/examples/todoapp-lite/iosApp/iosApp/iOSApp.swift index c659acb3d0..927e0b97b8 100644 --- a/examples/todoapp-lite/iosApp/iosApp/iOSApp.swift +++ b/examples/todoapp-lite/iosApp/iosApp/iOSApp.swift @@ -1,22 +1,10 @@ -import UIKit import SwiftUI -import shared @main struct iOSApp: App { var body: some Scene { WindowGroup { - ComposeView() - .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + ContentView() } } } - -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - Main_iosKt.MainViewController() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) { - } -} diff --git a/examples/widgets-gallery/iosApp/iosApp.xcodeproj/project.pbxproj b/examples/widgets-gallery/iosApp/iosApp.xcodeproj/project.pbxproj index 372dae9a78..1d201e9a59 100644 --- a/examples/widgets-gallery/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/examples/widgets-gallery/iosApp/iosApp.xcodeproj/project.pbxproj @@ -10,12 +10,14 @@ 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; }; 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; }; 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; }; + 3251B1442AA8DCBF001521C0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3251B1432AA8DCBF001521C0 /* ContentView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; }; + 3251B1432AA8DCBF001521C0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7555FF7B242A565900829871 /* WidgetsGallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WidgetsGallery.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -65,6 +67,7 @@ 7555FF8C242A565B00829871 /* Info.plist */, 2152FB032600AC8F00CF470E /* iOSApp.swift */, 058557D7273AAEEB004C7B11 /* Preview Content */, + 3251B1432AA8DCBF001521C0 /* ContentView.swift */, ); path = iosApp; sourceTree = ""; @@ -176,6 +179,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3251B1442AA8DCBF001521C0 /* ContentView.swift in Sources */, 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/widgets-gallery/iosApp/iosApp/ContentView.swift b/examples/widgets-gallery/iosApp/iosApp/ContentView.swift new file mode 100644 index 0000000000..8ccaf13b1c --- /dev/null +++ b/examples/widgets-gallery/iosApp/iosApp/ContentView.swift @@ -0,0 +1,19 @@ +import UIKit +import SwiftUI +import shared + +struct ContentView: View { + var body: some View { + ComposeView() + .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + } +} + +struct ComposeView: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> UIViewController { + Main_iosKt.MainViewController() + } + + func updateUIViewController(_ uiViewController: UIViewController, context: Context) { + } +} diff --git a/examples/widgets-gallery/iosApp/iosApp/iOSApp.swift b/examples/widgets-gallery/iosApp/iosApp/iOSApp.swift index c659acb3d0..927e0b97b8 100644 --- a/examples/widgets-gallery/iosApp/iosApp/iOSApp.swift +++ b/examples/widgets-gallery/iosApp/iosApp/iOSApp.swift @@ -1,22 +1,10 @@ -import UIKit import SwiftUI -import shared @main struct iOSApp: App { var body: some Scene { WindowGroup { - ComposeView() - .ignoresSafeArea(.keyboard) // Compose has own keyboard handler + ContentView() } } } - -struct ComposeView: UIViewControllerRepresentable { - func makeUIViewController(context: Context) -> UIViewController { - Main_iosKt.MainViewController() - } - - func updateUIViewController(_ uiViewController: UIViewController, context: Context) { - } -}