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

Updated for Xcode 11 Beta3
This commit is contained in:
Ivan Vorobei
2019-07-08 23:57:05 +03:00
committed by GitHub
35 changed files with 207 additions and 88 deletions

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Other Projects/2048 Game/SwiftUI2048.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Animating Views And Transitions/Complete/Landmarks/AnimatingViewsAndTransitions.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Building Lists And Navigation/Complete/Landmarks/BuildingListsAndNavigation.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Calculator/Calculator/Calculator.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Combine using GitHub API/SwiftUI-Combine-Example.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Composing Complex Interfaces/Complete/Landmarks/ComposingComplexInterfaces.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Creating And Combining Views/Complete/Landmarks/CreatingAndCombiningViews.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Currency-SwiftUI/Currency-SwiftUI.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Drawing Paths And Shapes/Complete/Landmarks/DrawingPathsAndShapes.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Example To-Do App/SwiftUITodo.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Flux/SwiftUI-Flux.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/GitHub Search/GitHubSearchWithSwiftUI.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Handling User Input/Complete/Landmarks/HandlingUserInput.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/InstaFake/Instagram-SWUI.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Interfacing With UIKit/Complete/Landmarks/InterfacingWithUIKit.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/iPadOS Scenes/BehindTheScenes.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Jike/SwiftUI_Jike.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Movie/MovieSwift/MovieSwift.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/SwiftUI + Redux/SwiftUIDemo.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Tempus RomanumIl/TempusRomanum.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Time Travel/SwiftUITimeTravel.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Transition and Blur/Basic Animation/SwiftUI-BasicAnimation.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Transition and Blur/Card Animation/SwiftUI-CardAnimation.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/UINote/SwiftUINote.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/Working With UIControls/Complete/Landmarks/WorkingWithUIControls.xcodeproj">
</FileRef>
<FileRef
location = "group:Other Projects/WWDCPlayer/WWDCPlayer.xcodeproj">
</FileRef>
</Workspace>

View File

View File

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) LandmarkRow(landmark: landmark)
} }

View File

@@ -18,11 +18,13 @@ 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: LandmarkList().environmentObject(UserData())) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: LandmarkList().environmentObject(UserData()))
window.makeKeyAndVisible() self.window = window
} window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system. // Called as the scene is being released by the system.

View File

@@ -11,7 +11,7 @@ struct LandmarkList: View {
var body: some View { var body: some View {
NavigationView { NavigationView {
List(landmarkData) { landmark in List(landmarkData) { landmark in
NavigationButton(destination: LandmarkDetail(landmark: landmark)) { NavigationLink(destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) 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). // 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: LandmarkList()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: LandmarkList())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -20,10 +20,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: Calculator()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: Calculator())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -12,7 +12,7 @@ struct CategoryRow: View {
var items: [Landmark] var items: [Landmark]
var body: some View { var body: some View {
VStack(alignment: .leading) { VStack(alignment: HorizontalAlignment.leading) {
Text(self.categoryName) Text(self.categoryName)
.font(.headline) .font(.headline)
.padding(.leading, 15) .padding(.leading, 15)
@@ -21,7 +21,7 @@ struct CategoryRow: View {
ScrollView(showsHorizontalIndicator: false) { ScrollView(showsHorizontalIndicator: false) {
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
) )

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) 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). // 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: ContentView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -36,7 +36,7 @@ struct ConverterView : View {
let inset = EdgeInsets(top: -8, leading: -20, bottom: -7, trailing: 5) let inset = EdgeInsets(top: -8, leading: -20, bottom: -7, trailing: 5)
let doubleValue: Double = Double(self.$baseAmount.value) ?? 1.0 let doubleValue: Double = Double(self.$baseAmount.value) ?? 1.0
return ZStack(alignment: .bottomTrailing) { return ZStack(alignment: Alignment.bottomTrailing) {
VStack(alignment: .leading){ VStack(alignment: .leading){
Text("From:").bold().color(.gray) Text("From:").bold().color(.gray)
HStack{ HStack{

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) LandmarkRow(landmark: landmark)
} }

View File

@@ -18,11 +18,13 @@ 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: LandmarkList().environmentObject(UserData())) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: LandmarkList().environmentObject(UserData()))
window.makeKeyAndVisible() self.window = window
} window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system. // Called as the scene is being released by the system.

View File

@@ -5,9 +5,11 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow? var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let window = UIWindow(frame: UIScreen.main.bounds) if let windowScene = scene as? UIWindowScene {
window.rootViewController = UIHostingController(rootView: CounterView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: CounterView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
} }

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) 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). // 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: LandmarkList().environmentObject(UserData())) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: LandmarkList().environmentObject(UserData()))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -19,7 +19,7 @@ struct ContentView : View {
ForEach(instaPhotos.identified(by: \.id)) { ForEach(instaPhotos.identified(by: \.id)) {
ImageCell(photo: $0) ImageCell(photo: $0)
} }
}.navigationBarTitle(Text("WWDC")).navigationBarItems(trailing: PresentationButton(Text("Camera"), destination: CameraView())) }.navigationBarTitle("WWDC").navigationBarItems(trailing: PresentationLink("Camera", destination: CameraView()))
} }
} }

View File

@@ -20,11 +20,13 @@ 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: ContentView(instaPhotos: [InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame"], likes: 100, image: "wwdc"),InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame","Nice", "Cool","Lame"], likes: 200, image: "pizza"), let window = UIWindow(windowScene: windowScene)
InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame","Nice", "Cool","Lame","Nice", "Cool","Lame","Nice", "Cool","Lame"], likes: 4440, image: "wwdc"),InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool"], likes: 20, image: "badge")])) window.rootViewController = UIHostingController(rootView: ContentView(instaPhotos: [InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame"], likes: 100, image: "wwdc"),InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame","Nice", "Cool","Lame"], likes: 200, image: "pizza"),
self.window = window InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool","Lame","Nice", "Cool","Lame","Nice", "Cool","Lame","Nice", "Cool","Lame"], likes: 4440, image: "wwdc"),InstaPhoto(id: 0, username: "leavenstee", comments: ["Nice", "Cool"], likes: 20, image: "badge")]))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) LandmarkRow(landmark: landmark)
} }

View File

@@ -12,7 +12,7 @@ struct CategoryRow: View {
var body: some View { var body: some View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
ScrollView(showsHorizontalIndicator: false) { ScrollView(.horizontal) {
HStack(alignment: .top, spacing: 0) { HStack(alignment: .top, spacing: 0) {
ForEach(self.items.identified(by: \.id)) { zone in ForEach(self.items.identified(by: \.id)) { zone in
CategoryItem(zone: zone) CategoryItem(zone: zone)

View File

@@ -20,10 +20,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: ContentView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -21,7 +21,9 @@ final class AppState: BindableObject {
func dispatch(action: Action) { func dispatch(action: Action) {
moviesState = MoviesStateReducer().reduce(state: moviesState, action: action) moviesState = MoviesStateReducer().reduce(state: moviesState, action: action)
didChange.send(self) DispatchQueue.main.async {
self.didChange.send(self)
}
} }
} }

View File

@@ -20,10 +20,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: ContentView().environmentObject(store)) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView().environmentObject(store))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -15,10 +15,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let window = UIWindow(frame: UIScreen.main.bounds) if let windowScene = scene as? UIWindowScene {
window.rootViewController = UIHostingController(rootView: TabbarView().environmentObject(store)) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: TabbarView().environmentObject(store))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
} }

View File

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

View File

@@ -6,6 +6,7 @@ struct Home : View {
var body: some View { var body: some View {
VStack { VStack {
Text("Hello World") Text("Hello World")
ClockView()
} }
} }
} }

View File

@@ -14,10 +14,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: Home()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: Home())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -12,10 +12,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: ContentView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -20,10 +20,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: ContentView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -20,10 +20,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: ContentView()) let window = UIWindow(windowScene: windowScene)
self.window = window window.rootViewController = UIHostingController(rootView: ContentView())
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -20,11 +20,13 @@ 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: NoteList() let window = UIWindow(windowScene: windowScene)
.environmentObject(UserData())) window.rootViewController = UIHostingController(rootView: NoteList()
self.window = window .environmentObject(UserData()))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

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

View File

@@ -20,11 +20,13 @@ 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: MainView() let window = UIWindow(windowScene: windowScene)
.environmentObject(UserData())) window.rootViewController = UIHostingController(rootView: MainView()
self.window = window .environmentObject(UserData()))
window.makeKeyAndVisible() self.window = window
window.makeKeyAndVisible()
}
} }
func sceneDidDisconnect(_ scene: UIScene) { func sceneDidDisconnect(_ scene: UIScene) {

View File

@@ -19,7 +19,7 @@ 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 {
NavigationButton( NavigationLink(
destination: LandmarkDetail(landmark: landmark)) { destination: LandmarkDetail(landmark: landmark)) {
LandmarkRow(landmark: landmark) LandmarkRow(landmark: landmark)
} }