Skip to content

Commit 6e48ab0

Browse files
committed
Migrate compose to ios integration to UIKit
1 parent 9bd9b37 commit 6e48ab0

File tree

2 files changed

+36
-49
lines changed

2 files changed

+36
-49
lines changed

iosApp/iosApp.xcodeproj/project.pbxproj

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 56;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -13,7 +13,7 @@
1313
/* End PBXBuildFile section */
1414

1515
/* Begin PBXFileReference section */
16-
A93A953729CC810C00F8E227 /* Material 3 gallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Material 3 gallery.app"; sourceTree = BUILT_PRODUCTS_DIR; };
16+
A93A953729CC810C00F8E227 /* Material 3 gallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Material 3 gallery.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1717
A93A953A29CC810C00F8E227 /* iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iosApp.swift; sourceTree = "<group>"; };
1818
A93A953E29CC810D00F8E227 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1919
A93A954129CC810D00F8E227 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
@@ -219,6 +219,8 @@
219219
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220220
GCC_WARN_UNUSED_FUNCTION = YES;
221221
GCC_WARN_UNUSED_VARIABLE = YES;
222+
INFOPLIST_FILE = "";
223+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
222224
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
223225
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
224226
MTL_FAST_MATH = YES;
@@ -273,6 +275,8 @@
273275
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
274276
GCC_WARN_UNUSED_FUNCTION = YES;
275277
GCC_WARN_UNUSED_VARIABLE = YES;
278+
INFOPLIST_FILE = "";
279+
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
276280
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
277281
MTL_ENABLE_DEBUG_INFO = NO;
278282
MTL_FAST_MATH = YES;
@@ -292,26 +296,21 @@
292296
CURRENT_PROJECT_VERSION = 1;
293297
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
294298
ENABLE_PREVIEWS = YES;
295-
FRAMEWORK_SEARCH_PATHS = (
296-
"${inherited}",
297-
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
298-
);
299+
FRAMEWORK_SEARCH_PATHS = (
300+
"${inherited}",
301+
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
302+
);
299303
GENERATE_INFOPLIST_FILE = YES;
300-
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
301-
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
302-
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
303-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
304-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
305304
LD_RUNPATH_SEARCH_PATHS = (
306305
"$(inherited)",
307306
"@executable_path/Frameworks",
308307
);
309308
MARKETING_VERSION = 1.0;
310-
OTHER_LDFLAGS = (
311-
"${inherited}",
312-
"-framework",
313-
ComposeApp,
314-
);
309+
OTHER_LDFLAGS = (
310+
"${inherited}",
311+
"-framework",
312+
ComposeApp,
313+
);
315314
PRODUCT_BUNDLE_IDENTIFIER = com.github.terrakok.iosApp;
316315
PRODUCT_NAME = "Material 3 gallery";
317316
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -329,26 +328,21 @@
329328
CURRENT_PROJECT_VERSION = 1;
330329
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
331330
ENABLE_PREVIEWS = YES;
332-
FRAMEWORK_SEARCH_PATHS = (
333-
"${inherited}",
334-
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
335-
);
331+
FRAMEWORK_SEARCH_PATHS = (
332+
"${inherited}",
333+
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
334+
);
336335
GENERATE_INFOPLIST_FILE = YES;
337-
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
338-
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
339-
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
340-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
341-
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
342336
LD_RUNPATH_SEARCH_PATHS = (
343337
"$(inherited)",
344338
"@executable_path/Frameworks",
345339
);
346340
MARKETING_VERSION = 1.0;
347-
OTHER_LDFLAGS = (
348-
"${inherited}",
349-
"-framework",
350-
ComposeApp,
351-
);
341+
OTHER_LDFLAGS = (
342+
"${inherited}",
343+
"-framework",
344+
ComposeApp,
345+
);
352346
PRODUCT_BUNDLE_IDENTIFIER = com.github.terrakok.iosApp;
353347
PRODUCT_NAME = "Material 3 gallery";
354348
SWIFT_EMIT_LOC_STRINGS = YES;

iosApp/iosApp/iosApp.swift

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
import UIKit
2-
import SwiftUI
32
import ComposeApp
43

54
@main
6-
struct iosApp: App {
7-
var body: some Scene {
8-
WindowGroup {
9-
ContentView()
10-
}
11-
}
12-
}
13-
14-
struct ContentView: View {
15-
var body: some View {
16-
ComposeView().ignoresSafeArea(.all)
17-
}
18-
}
5+
class AppDelegate: UIResponder, UIApplicationDelegate {
6+
var window: UIWindow?
197

20-
struct ComposeView: UIViewControllerRepresentable {
21-
func makeUIViewController(context: Context) -> UIViewController {
22-
MainKt.MainViewController()
8+
func application(
9+
_ application: UIApplication,
10+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
11+
) -> Bool {
12+
window = UIWindow(frame: UIScreen.main.bounds)
13+
if let window = window {
14+
window.rootViewController = MainKt.MainViewController()
15+
window.makeKeyAndVisible()
16+
}
17+
return true
2318
}
24-
25-
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
2619
}

0 commit comments

Comments
 (0)