https://github.com/kashif-e/native-ios-navigation-compose-multiplatform
native ios navigation for compose multiplatform using kotlin Objc Interop
https://github.com/kashif-e/native-ios-navigation-compose-multiplatform
compose-multiplatform compose-navigation ios kotlin-native kotlinmultiplatform navigation
Last synced: 3 months ago
JSON representation
native ios navigation for compose multiplatform using kotlin Objc Interop
- Host: GitHub
- URL: https://github.com/kashif-e/native-ios-navigation-compose-multiplatform
- Owner: Kashif-E
- License: mit
- Created: 2024-08-28T17:13:37.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T07:29:02.000Z (over 1 year ago)
- Last Synced: 2025-09-03T13:45:25.226Z (9 months ago)
- Topics: compose-multiplatform, compose-navigation, ios, kotlin-native, kotlinmultiplatform, navigation
- Language: Kotlin
- Homepage:
- Size: 104 KB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Compose Multiplatform Application with IOS native Navigation for IOS App in common code and Voyager for other platforms
- use voyant to get started without any boilerplater [Voyant](https://github.com/kashif-e/voyant) for using ios navigation with CMP
- Looking to build with KMP and CMP? Let's connect [LinkedIn](https://www.linkedin.com/in/kashif-mehmood-km/)
- Featured in [Kotlin Weekly](https://mailchi.mp/kotlinweekly/kotlin-weekly-422)
#### Want to support my work ?

## Experiment: iOS Navigation with Compose Multiplatform ๐ด๐งโ๐๐ข
This project is an experiment to explore how iOS navigation can be implemented using Compose Multiplatform. The goal is to leverage Kotlin Multiplatform capabilities to create a seamless navigation experience on both Android and iOS platforms.
### How It Works
1. **Navigation Setup**:
- The `Navigator` class is used to manage navigation between different screens.
- The `BottomSheetNavigator` is used to handle bottom sheet navigation.
2. **View Controller Wrapping**:
- The `extendedComposeViewController` function creates a `UIViewController` that hosts a Compose UI.
- The `UIViewControllerWrapper` class wraps another `UIViewController` and adds gesture recognizer functionality to handle swipe gestures.
3. **Gesture Handling**:
- The `UIViewControllerWrapper` implements the `UIGestureRecognizerDelegateProtocol` to handle swipe gestures.
- Swipe gestures are added to the view controller to enable navigation through swiping.
4. **Interactive Pop Gesture**:
- The `interactivePopGestureRecognizer` is enabled for the entire screen to allow swipe-back navigation.
- The delegate for the `interactivePopGestureRecognizer` is set to the `UIViewControllerWrapper` to manage the gesture.
## Demo
[](https://www.youtube.com/shorts/HdPoG59DYws)