https://github.com/joreilly/peopleinspacepackage
Swift Package for https://github.com/joreilly/PeopleInSpace.
https://github.com/joreilly/peopleinspacepackage
ios kotlin-multiplatform swift-package-manager
Last synced: 6 days ago
JSON representation
Swift Package for https://github.com/joreilly/PeopleInSpace.
- Host: GitHub
- URL: https://github.com/joreilly/peopleinspacepackage
- Owner: joreilly
- Created: 2021-01-21T14:53:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-03T14:57:41.000Z (about 1 year ago)
- Last Synced: 2025-03-31T08:21:18.547Z (about 1 month ago)
- Topics: ios, kotlin-multiplatform, swift-package-manager
- Language: Objective-C
- Homepage:
- Size: 67.2 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PeopleInSpacePackage
Swift Package for https://github.com/joreilly/PeopleInSpace. Note that this uses https://github.com/rickclephas/KMP-NativeCoroutines library and right now Swift Package for this needs to be also manually added (looking at ways to do this automatically).
### Example SwiftUI code
```swift
import SwiftUI
import common
import KMPNativeCoroutinesAsyncstruct ContentView: View {
let repository = PeopleInSpaceRepository()
@State var people = [Assignment]()
var body: some View {
List(people, id: \.name) { person in
Text(person.name)
}
.task {
await startObservingPeopleUpdates()
}
}func startObservingPeopleUpdates() async {
do {
let stream = asyncStream(for: repository.fetchPeopleAsFlowNative())
for try await data in stream {
self.people = data
}
} catch {
print("Failed with error: \(error)")
}
}
}
```Note that it's also necessary to initialise Koin (like following for example)
```swift
import SwiftUI
import ConfettiKit@main
struct YourApp: App {
init() {
KoinKt.doInitKoin()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
```