mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-31 06:23:18 +02:00
Merge pull request #6 from johnno1962/xcode-11-beta3
A few more run time fixes
This commit is contained in:
@@ -20,7 +20,8 @@ struct LandmarkList: View {
|
|||||||
ForEach(userData.landmarks) { landmark in
|
ForEach(userData.landmarks) { landmark in
|
||||||
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(landmark: landmark)) {
|
destination: LandmarkDetail(landmark: landmark)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
LandmarkRow(landmark: landmark)
|
LandmarkRow(landmark: landmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ struct CategoryRow: View {
|
|||||||
var items: [Landmark]
|
var items: [Landmark]
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: HorizontalAlignment.leading) {
|
VStack(alignment: .leading) {
|
||||||
Text(self.categoryName)
|
Text(self.categoryName)
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
.padding(.leading, 15)
|
.padding(.leading, 15)
|
||||||
.padding(.top, 5)
|
.padding(.top, 5)
|
||||||
|
|
||||||
ScrollView(showsHorizontalIndicator: false) {
|
ScrollView {
|
||||||
HStack(alignment: .top, spacing: 0) {
|
HStack(alignment: .top, spacing: 0) {
|
||||||
ForEach(self.items.identified(by: \.name)) { landmark in
|
ForEach(self.items.identified(by: \.name)) { landmark in
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
|
|||||||
@@ -33,19 +33,18 @@ struct CategoryHome: View {
|
|||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
|
|
||||||
NavigationButton(destination: LandmarkList()) {
|
NavigationLink(destination: LandmarkList()) {
|
||||||
Text("See All")
|
Text("See All")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Featured"))
|
.navigationBarTitle(Text("Featured"))
|
||||||
.navigationBarItems(trailing:
|
.navigationBarItems(trailing:
|
||||||
PresentationButton(
|
PresentationLink(destination: Text("User Profile")) {
|
||||||
Image(systemName: "person.crop.circle")
|
Image(systemName: "person.crop.circle")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.accessibility(label: Text("User Profile"))
|
.accessibility(label: Text("User Profile"))
|
||||||
.padding(),
|
.padding()
|
||||||
destination: Text("User Profile")
|
}
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ struct LandmarkList: View {
|
|||||||
ForEach(userData.landmarks) { landmark in
|
ForEach(userData.landmarks) { landmark in
|
||||||
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(landmark: landmark)) {
|
destination: LandmarkDetail(landmark: landmark)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
LandmarkRow(landmark: landmark)
|
LandmarkRow(landmark: landmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||||
|
|
||||||
// Use a UIHostingController as window root view controller
|
// Use a UIHostingController as window root view controller
|
||||||
let window = UIWindow(frame: UIScreen.main.bounds)
|
if let windowScene = scene as? UIWindowScene {
|
||||||
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
let window = UIWindow(windowScene: windowScene)
|
||||||
self.window = window
|
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
||||||
window.makeKeyAndVisible()
|
self.window = window
|
||||||
|
window.makeKeyAndVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sceneDidDisconnect(_ scene: UIScene) {
|
func sceneDidDisconnect(_ scene: UIScene) {
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ struct LandmarkList: View {
|
|||||||
ForEach(userData.landmarks) { landmark in
|
ForEach(userData.landmarks) { landmark in
|
||||||
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(landmark: landmark)) {
|
destination: LandmarkDetail(landmark: landmark)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
LandmarkRow(landmark: landmark)
|
LandmarkRow(landmark: landmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ struct LandmarkList: View {
|
|||||||
ForEach(userData.landmarks) { landmark in
|
ForEach(userData.landmarks) { landmark in
|
||||||
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(landmark: landmark)) {
|
destination: LandmarkDetail(landmark: landmark)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
LandmarkRow(landmark: landmark)
|
LandmarkRow(landmark: landmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ struct CategoryRow: View {
|
|||||||
.padding(.leading, 15)
|
.padding(.leading, 15)
|
||||||
.padding(.top, 5)
|
.padding(.top, 5)
|
||||||
|
|
||||||
ScrollView(showsHorizontalIndicator: false) {
|
ScrollView([]) {
|
||||||
HStack(alignment: .top, spacing: 0) {
|
HStack(alignment: .top, spacing: 0) {
|
||||||
ForEach(self.items.identified(by: \.name)) { landmark in
|
ForEach(self.items.identified(by: \.name)) { landmark in
|
||||||
NavigationButton(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(
|
destination: LandmarkDetail(
|
||||||
landmark: landmark
|
landmark: landmark
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,19 +33,18 @@ struct CategoryHome: View {
|
|||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
|
|
||||||
NavigationButton(destination: LandmarkList()) {
|
NavigationLink(destination: LandmarkList()) {
|
||||||
Text("See All")
|
Text("See All")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Featured"))
|
.navigationBarTitle(Text("Featured"))
|
||||||
.navigationBarItems(trailing:
|
.navigationBarItems(trailing:
|
||||||
PresentationButton(
|
PresentationLink(destination: ProfileHost()) {
|
||||||
Image(systemName: "person.crop.circle")
|
Image(systemName: "person.crop.circle")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.accessibility(label: Text("User Profile"))
|
.accessibility(label: Text("User Profile"))
|
||||||
.padding(),
|
.padding()
|
||||||
destination: ProfileHost()
|
}
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ struct LandmarkList: View {
|
|||||||
ForEach(userData.landmarks) { landmark in
|
ForEach(userData.landmarks) { landmark in
|
||||||
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
if !self.userData.showFavoritesOnly || landmark.isFavorite {
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(landmark: landmark)) {
|
destination: LandmarkDetail(landmark: landmark)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
LandmarkRow(landmark: landmark)
|
LandmarkRow(landmark: landmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||||
|
|
||||||
// Use a UIHostingController as window root view controller
|
// Use a UIHostingController as window root view controller
|
||||||
let window = UIWindow(frame: UIScreen.main.bounds)
|
if let windowScene = scene as? UIWindowScene {
|
||||||
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
let window = UIWindow(windowScene: windowScene)
|
||||||
self.window = window
|
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
||||||
window.makeKeyAndVisible()
|
self.window = window
|
||||||
|
window.makeKeyAndVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sceneDidDisconnect(_ scene: UIScene) {
|
func sceneDidDisconnect(_ scene: UIScene) {
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ struct UsersListView : View {
|
|||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
ForEach(state.usersState.users) {user in
|
ForEach(state.usersState.users) {user in
|
||||||
NavigationLink(destination: UserDetailView(userId: user.id)) {
|
NavigationLink(destination: UserDetailView(userId: user.id)
|
||||||
|
.environmentObject(self.state)) {
|
||||||
UserRow(user: user)
|
UserRow(user: user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ struct NoteList : View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
List(userData.notes) { note in
|
List(userData.notes) { note in
|
||||||
NavigationLink(destination: NoteDetail(note: note)) {
|
NavigationLink(destination: NoteDetail(note: note)
|
||||||
|
.environmentObject(self.userData)) {
|
||||||
NoteRow(note: note)
|
NoteRow(note: note)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ struct CategoryRow: View {
|
|||||||
.padding(.leading, 15)
|
.padding(.leading, 15)
|
||||||
.padding(.top, 5)
|
.padding(.top, 5)
|
||||||
|
|
||||||
ScrollView(showsHorizontalIndicator: false) {
|
ScrollView {
|
||||||
HStack(alignment: .top, spacing: 0) {
|
HStack(alignment: .top, spacing: 0) {
|
||||||
ForEach(self.items.identified(by: \.name)) { landmark in
|
ForEach(self.items.identified(by: \.name)) { landmark in
|
||||||
NavigationButton(
|
NavigationLink(
|
||||||
destination: LandmarkDetail(
|
destination: LandmarkDetail(
|
||||||
landmark: landmark
|
landmark: landmark
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,20 +33,18 @@ struct CategoryHome: View {
|
|||||||
}
|
}
|
||||||
.listRowInsets(EdgeInsets())
|
.listRowInsets(EdgeInsets())
|
||||||
|
|
||||||
NavigationButton(destination: LandmarkList()) {
|
NavigationLink(destination: LandmarkList()) {
|
||||||
Text("See All")
|
Text("See All")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationBarTitle(Text("Featured"))
|
.navigationBarTitle(Text("Featured"))
|
||||||
.navigationBarItems(trailing:
|
.navigationBarItems(trailing:
|
||||||
PresentationButton(
|
PresentationLink(destination: ProfileHost()) {
|
||||||
Image(systemName: "person.crop.circle")
|
Image(systemName: "person.crop.circle")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.accessibility(label: Text("User Profile"))
|
.accessibility(label: Text("User Profile"))
|
||||||
.padding(),
|
.padding()
|
||||||
destination: ProfileHost()
|
})
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||||
|
|
||||||
// Use a UIHostingController as window root view controller
|
// Use a UIHostingController as window root view controller
|
||||||
let window = UIWindow(frame: UIScreen.main.bounds)
|
if let windowScene = scene as? UIWindowScene {
|
||||||
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
let window = UIWindow(windowScene: windowScene)
|
||||||
self.window = window
|
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
|
||||||
window.makeKeyAndVisible()
|
self.window = window
|
||||||
|
window.makeKeyAndVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sceneDidDisconnect(_ scene: UIScene) {
|
func sceneDidDisconnect(_ scene: UIScene) {
|
||||||
|
|||||||
Reference in New Issue
Block a user