Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
joreilly committed Jan 14, 2020
1 parent 13732c6 commit 735a049
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using **Jetpack Compose** and on iOS using **SwiftUI**

**Note**: You need to use Android Studio v4.0 (currently on Canary 6). Have tested on XCode v11.3

**Update Jan 14th 2020**: This now also includes WatchOS version thanks to [Neal Sanche](https://github.com/nealsanche). That
also includes use of `NavigationLink`

The following is pretty much all the code used (along with gradle files/resources etc). I did say it was *minimal*!!

Expand Down Expand Up @@ -44,6 +46,36 @@ struct PersonView : View {
}
```


### WatchOS SwiftUI Code

```swift
struct ContentView: View {
@ObservedObject var peopleInSpaceViewModel = PeopleInSpaceViewModel(repository: PeopleInSpaceRepository())

var body: some View {
VStack {
List(peopleInSpaceViewModel.people, id: \.name) { person in
PersonView(person: person)
}
.onAppear(perform: {
self.peopleInSpaceViewModel.fetch()
})
}
}
}

struct PersonView : View {
var person: Assignment

var body: some View {
NavigationLink(person.name, destination: Text(person.craft).font(.subheadline))
}
}
```



### iOS Swift ViewModel

```swift
Expand Down

0 comments on commit 735a049

Please sign in to comment.