Merge pull request #6 from johnno1962/xcode-11-beta3

A few more run time fixes
This commit is contained in:
Ivan Vorobei
2019-07-09 11:46:01 +03:00
committed by GitHub
16 changed files with 50 additions and 41 deletions

View File

@@ -20,7 +20,8 @@ struct LandmarkList: View {
ForEach(userData.landmarks) { landmark in
if !self.userData.showFavoritesOnly || landmark.isFavorite {
NavigationLink(
destination: LandmarkDetail(landmark: landmark)) {
destination: LandmarkDetail(landmark: landmark)
.environmentObject(self.userData)) {
LandmarkRow(landmark: landmark)
}
}

View File

@@ -12,13 +12,13 @@ struct CategoryRow: View {
var items: [Landmark]
var body: some View {
VStack(alignment: HorizontalAlignment.leading) {
VStack(alignment: .leading) {
Text(self.categoryName)
.font(.headline)
.padding(.leading, 15)
.padding(.top, 5)
ScrollView(showsHorizontalIndicator: false) {
ScrollView {
HStack(alignment: .top, spacing: 0) {
ForEach(self.items.identified(by: \.name)) { landmark in
NavigationLink(

View File

@@ -33,19 +33,18 @@ struct CategoryHome: View {
}
.listRowInsets(EdgeInsets())
NavigationButton(destination: LandmarkList()) {
NavigationLink(destination: LandmarkList()) {
Text("See All")
}
}
.navigationBarTitle(Text("Featured"))
.navigationBarItems(trailing:
PresentationButton(
PresentationLink(destination: Text("User Profile")) {
Image(systemName: "person.crop.circle")
.imageScale(.large)
.accessibility(label: Text("User Profile"))
.padding(),
destination: Text("User Profile")
)
.padding()
}
)
}
}

View File

@@ -20,7 +20,8 @@ struct LandmarkList: View {
ForEach(userData.landmarks) { landmark in
if !self.userData.showFavoritesOnly || landmark.isFavorite {
NavigationLink(
destination: LandmarkDetail(landmark: landmark)) {
destination: LandmarkDetail(landmark: landmark)
.environmentObject(self.userData)) {
LandmarkRow(landmark: landmark)
}
}

View File

@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use a UIHostingController as window root view controller
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -20,7 +20,8 @@ struct LandmarkList: View {
ForEach(userData.landmarks) { landmark in
if !self.userData.showFavoritesOnly || landmark.isFavorite {
NavigationLink(
destination: LandmarkDetail(landmark: landmark)) {
destination: LandmarkDetail(landmark: landmark)
.environmentObject(self.userData)) {
LandmarkRow(landmark: landmark)
}
}

View File

@@ -20,7 +20,8 @@ struct LandmarkList: View {
ForEach(userData.landmarks) { landmark in
if !self.userData.showFavoritesOnly || landmark.isFavorite {
NavigationLink(
destination: LandmarkDetail(landmark: landmark)) {
destination: LandmarkDetail(landmark: landmark)
.environmentObject(self.userData)) {
LandmarkRow(landmark: landmark)
}
}

View File

@@ -18,10 +18,10 @@ struct CategoryRow: View {
.padding(.leading, 15)
.padding(.top, 5)
ScrollView(showsHorizontalIndicator: false) {
ScrollView([]) {
HStack(alignment: .top, spacing: 0) {
ForEach(self.items.identified(by: \.name)) { landmark in
NavigationButton(
NavigationLink(
destination: LandmarkDetail(
landmark: landmark
)

View File

@@ -33,19 +33,18 @@ struct CategoryHome: View {
}
.listRowInsets(EdgeInsets())
NavigationButton(destination: LandmarkList()) {
NavigationLink(destination: LandmarkList()) {
Text("See All")
}
}
.navigationBarTitle(Text("Featured"))
.navigationBarItems(trailing:
PresentationButton(
PresentationLink(destination: ProfileHost()) {
Image(systemName: "person.crop.circle")
.imageScale(.large)
.accessibility(label: Text("User Profile"))
.padding(),
destination: ProfileHost()
)
.padding()
}
)
}
}

View File

@@ -20,7 +20,8 @@ struct LandmarkList: View {
ForEach(userData.landmarks) { landmark in
if !self.userData.showFavoritesOnly || landmark.isFavorite {
NavigationLink(
destination: LandmarkDetail(landmark: landmark)) {
destination: LandmarkDetail(landmark: landmark)
.environmentObject(self.userData)) {
LandmarkRow(landmark: landmark)
}
}

View File

@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use a UIHostingController as window root view controller
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -24,7 +24,8 @@ struct UsersListView : View {
}
Section {
ForEach(state.usersState.users) {user in
NavigationLink(destination: UserDetailView(userId: user.id)) {
NavigationLink(destination: UserDetailView(userId: user.id)
.environmentObject(self.state)) {
UserRow(user: user)
}
}

View File

@@ -14,7 +14,8 @@ struct NoteList : View {
var body: some View {
NavigationView {
List(userData.notes) { note in
NavigationLink(destination: NoteDetail(note: note)) {
NavigationLink(destination: NoteDetail(note: note)
.environmentObject(self.userData)) {
NoteRow(note: note)
}
}

View File

@@ -18,10 +18,10 @@ struct CategoryRow: View {
.padding(.leading, 15)
.padding(.top, 5)
ScrollView(showsHorizontalIndicator: false) {
ScrollView {
HStack(alignment: .top, spacing: 0) {
ForEach(self.items.identified(by: \.name)) { landmark in
NavigationButton(
NavigationLink(
destination: LandmarkDetail(
landmark: landmark
)

View File

@@ -33,20 +33,18 @@ struct CategoryHome: View {
}
.listRowInsets(EdgeInsets())
NavigationButton(destination: LandmarkList()) {
NavigationLink(destination: LandmarkList()) {
Text("See All")
}
}
.navigationBarTitle(Text("Featured"))
.navigationBarItems(trailing:
PresentationButton(
PresentationLink(destination: ProfileHost()) {
Image(systemName: "person.crop.circle")
.imageScale(.large)
.accessibility(label: Text("User Profile"))
.padding(),
destination: ProfileHost()
)
)
.padding()
})
}
}
}

View File

@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Use a UIHostingController as window root view controller
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {