Skip to content

Commit 3803bd4

Browse files
authored
Update README.md
1 parent 98e6d62 commit 3803bd4

File tree

1 file changed

+28
-76
lines changed

1 file changed

+28
-76
lines changed

README.md

Lines changed: 28 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -168,96 +168,48 @@ class DetailInstance(savedState: SavedStateHandle, detail: String) : InstanceKee
168168

169169
## Platform configurations 🚉
170170

171-
<details>
172-
<summary>Android / WearOS</summary>
171+
### Android / WearOS
173172

174-
**build.gradle.kts**
175-
```kotlin
176-
class MainActivity : ComponentActivity() {
177-
override fun onCreate(savedInstanceState: Bundle?) {
178-
super.onCreate(savedInstanceState)
179-
val rootRouterContext: RouterContext = defaultRouterContext()
180-
setContent {
181-
CompositionLocalProvider(LocalRouterContext provides rootRouterContext) {
182-
MaterialTheme {
183-
ListDetailScreen()
184-
}
185-
}
186-
}
187-
}
188-
}
189-
```
190-
</details>
173+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/src/androidMain/kotlin/io/github/xxfast/decompose/router/app/MainActivity.kt#L15-L30
191174

192-
<details>
193-
<summary>Desktop</summary>
175+
### Desktop
194176

195-
**build.gradle.kts**
196-
```kotlin
197-
fun main() {
198-
val windowState: WindowState = rememberWindowState()
199-
val rootRouterContext: RouterContext = defaultRouterContext(windowState = windowState)
200-
201-
application {
202-
Window(state = windowState) {
203-
CompositionLocalProvider(LocalRouterContext provides rootRouterContext) {
204-
MaterialTheme {
205-
ListDetailScreen()
206-
}
207-
}
208-
}
209-
}
210-
}
211-
```
177+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/src/desktopMain/kotlin/io/github/xxfast/decompose/router/app/Application.kt#L17-L36
178+
179+
### iOS
180+
181+
Make sure to create your root router context outside of `ComposeUIViewController`'s composable lambda and pass it in to `LocalRouterContext`
182+
183+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/src/iosMain/kotlin/io/github/xxfast/decompose/router/app/Application.kt#L39-L59
184+
185+
> [!IMPORTANT]
186+
> You will need to tie root `RouterContext`'s lifecycle to an `AppDelegate`.
187+
188+
<details>
189+
<summary>Kotlin app delegate</summary>
190+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/src/iosMain/kotlin/io/github/xxfast/decompose/router/app/AppDelegate.kt#L18-L52
212191
</details>
213192

214193
<details>
215-
<summary>iOS</summary>
194+
<summary>SwiftUI App / Swift UIKit AppDelegat</summary>
216195

217-
Make sure to create your root router context outside of `ComposeUIViewController`'s composable lambda and pass it in to `LocalRouterContext`
196+
#### UIKitAppDelegate
197+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/ios/ios/UIKitAppDelegate.swift#L5-L29
218198

219-
**build.gradle.kts**
220-
```kotlin
221-
fun MainUIController(rootRouterContext: RouterContext): UIViewController = ComposeUIViewController {
222-
CompositionLocalProvider(LocalRouterContext provides rootRouterContext) {
223-
MaterialTheme {
224-
ListDetailScreen()
225-
}
226-
}
227-
}
228-
```
229-
> [!IMPORTANT]
230-
> You will need to tie root `RouterContext`'s lifecycle to an `AppDelegate`.
231-
> * See Kotlin app delegate [here](https://github.com/xxfast/Decompose-Router/blob/main/app/src/iosMain/kotlin/io/github/xxfast/decompose/router/app/AppDelegate.kt),
232-
> * See Swift UIKit AppDelegate [here](https://github.com/xxfast/Decompose-Router/blob/main/app/ios/ios/UIKitAppDelegate.swift).
233-
> * See SwiftUI App [here](https://github.com/xxfast/Decompose-Router/blob/main/app/ios/ios/SwiftUIApp.swift).
234-
> * Read more on the docs [here](https://arkivanov.github.io/Decompose/getting-started/quick-start/#ios-with-swiftui)
199+
#### SwiftUIApp
235200

201+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/ios/ios/SwiftUIApp.swift#L12-L55
202+
Read more on the docs [here](https://arkivanov.github.io/Decompose/getting-started/quick-start/#ios-with-swiftui)
203+
236204
> [!NOTE]
237-
> To invoke decompose router's `defaultRouterContext()` from swift, you will need to export decompose-router from your shared module
205+
> To invoke decompose router's `defaultRouterContext()` from swift, you will need to export decompose-router from your shared module
206+
> https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/build.gradle.kts#L25-L36
238207
</details>
239208
240-
<details>
241-
<summary>Web</summary>
209+
### Web
242210

243-
See example [here](https://github.com/xxfast/Decompose-Router/blob/main/app/src/jsMain/kotlin/io/github/xxfast/decompose/router/app/Application.kt), or read more on docs [here](https://arkivanov.github.io/Decompose/getting-started/quick-start/#javascript-web)
211+
https://github.com/xxfast/Decompose-Router/blob/98e6d62ed067c01f10d73c769a73fe1d7afbf49d/app/src/jsMain/kotlin/io/github/xxfast/decompose/router/app/Application.kt#L12-L26
244212

245-
**build.gradle.kts**
246-
```kotlin
247-
fun main() {
248-
onWasmReady {
249-
val rootRouterContext: RouterContext = defaultRouterContext()
250-
251-
BrowserViewportWindow(..) {
252-
CompositionLocalProvider(LocalRouterContext provides rootRouterContext) {
253-
MaterialTheme {
254-
ListDetailScreen()
255-
}
256-
}
257-
}
258-
}
259-
}
260-
```
261213
</details>
262214

263215
## Licence

0 commit comments

Comments
 (0)