From 5352157fbaf3742a3e7f9812d8852675af4b8a7b Mon Sep 17 00:00:00 2001 From: Kashif Mehmood Date: Mon, 7 Oct 2024 20:17:04 +0500 Subject: [PATCH] Updated README for swift ui (#10) * video demo * video demo * video demo * Update README.MD * added gif demo * added gif demo * added gif demo * added gif demo * version bump * updated README.MD * updated version and added kotlin weekly tag to README.MD * updated version and added kotlin weekly tag to README.MD * fixed sample * updated readme for swift ui usage * fixed sample dependencies --- README.MD | 33 +++++++++++++++++++++++++++++++++ composeApp/build.gradle.kts | 4 ++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 937d482..bd0254f 100644 --- a/README.MD +++ b/README.MD @@ -28,6 +28,39 @@ implementation("io.github.kashif-mehmood-km:voyant-voyagerx:0.0.5") ```Kotlin implementation("io.github.kashif-mehmood-km:voyant-navigation-compose:0.0.5") +``` + +## Swift UI + +- For Swift UI there is one small extra step + +```Swift + + +struct NavigationControllerWrapper: UIViewControllerRepresentable { + + func makeUIViewController(context: Context) -> UINavigationController { + // MainKt.MainViewController() is the entry point of the app wrapped inside a uinavigation controller + //so you can get the navigation controller from the view controller + let navigationController = UINavigationController(rootViewController: MainKt.MainViewController()) + navigationController.interactivePopGestureRecognizer?.isEnabled = true + return navigationController + } + + func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { + + } +} +// content view being used inside AppDelegate to set the root view controller +struct ContentView: View { + var body: some View { + NavigationControllerWrapper() + .edgesIgnoringSafeArea(.all) + } +} + + + ``` diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 6f8eed9..8e54834 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -46,8 +46,8 @@ kotlin { implementation(compose.material) implementation(compose.components.resources) implementation(compose.components.uiToolingPreview) -// api(projects.voyagerX) -// implementation(projects.navigationComposeX) + api(projects.voyagerX) + api(projects.navigationComposeX) implementation(libs.kotlinx.serialization.json) }