The following documentation is broken https://developer.apple.com/documentation/coredata/loading_and_displaying_a_large_data_feed
Post
Replies
Boosts
Views
Activity
Also this may help https://wolvideos.web.app/landmarkData.json
@KMT this is false... one can no longer log in even on non beta devices so this information is incorrect and unrelated
Does anyone have a clue? I've spent the last 3 days trying to solve this code none of the WWDC video even come closed to explaining what's going on
This
import SwiftUI
import Combine
struct ContentView: View {
@State private var isPresented = false
var body: some View {
Button("Show Modal with full screen") {
self.isPresented.toggle()
}
.fullScreenCover(isPresented: $isPresented, content: VideoList.init)
}
}
struct VideoList: View {
@Environment(\.presentationMode) var presentationMode
@ObservedObject private(set) var viewModel: ViewModel
@State private var isRefreshing = false
var body: some View {
NavigationView {
List(viewModel.videos.sorted { $0.id > $1.id}, id: \.id) { video in
NavigationLink(
destination: VideoDetails(viewModel: VideoDetails.ViewModel(video: video))) {
VideoRow(video: video)
}
}
.onPullToRefresh(isRefreshing: $isRefreshing, perform: {
self.viewModel.fetchVideos()
})
.onReceive(viewModel.$videos, perform: { _ in
self.isRefreshing = false
})
.navigationBarTitle(viewModel.navigationBarTitle)
}
.onAppear(perform: viewModel.fetchVideos)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
.edgesIgnoringSafeArea(.all)
.onTapGesture {
presentationMode.wrappedValue.dismiss()
}
}
}
#if DEBUG
struct VideoList_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
VideoList(viewModel: .init())
}
}
}
#endif
creates this error on line 19: Cannot convert value of type '(Environment<Binding<PresentationMode>>, VideoList.ViewModel) -> VideoList' to expected argument type '() -> VideoList'
trying to implement it like this:
import SwiftUI
import Combine
struct SwiftUIView: View {
@State var showSheetView = false
var body: some View {
NavigationView {
Text("Content")
.navigationBarTitle("SwiftUI Tutorials")
.navigationBarItems(trailing:
Button(action: {
self.showSheetView.toggle()
}) {
Image(systemName: "bell.circle.fill")
.font(Font.system(.title))
}
)
}.sheet(isPresented: $showSheetView) {
SheetView(showSheetView: self.$showSheetView)
}
}
}
struct SheetView: View {
@Binding var showSheetView: Bool
@ObservedObject private(set) var viewModel: ViewModel
@State private var isRefreshing = false
var body: some View {
NavigationView {
List(viewModel.videos.sorted { $0.id > $1.id}, id: \.id) { video in
NavigationLink(
destination: VideoDetails(viewModel: VideoDetails.ViewModel(video: video))) {
VideoRow(video: video)
}
}
.onPullToRefresh(isRefreshing: $isRefreshing, perform: {
self.viewModel.fetchVideos()
})
.onReceive(viewModel.$videos, perform: { _ in
self.isRefreshing = false
})
.navigationBarTitle(viewModel.navigationBarTitle)
}
.onAppear(perform: viewModel.fetchVideos)
.sheet(isPresented: $showSheetView) {
SheetView(showSheetView: self.$showSheetView)
}
}
}
leads to: Cannot find type 'ViewModel' in scope & The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions; on line 35 and 38.
@knshi Load left to right and then downward I dont know how else to describe that.... this is extremely frustrating no documentation helps or addresses this basic idea! UItableviews made it so easy to do this simple view
@knshi
iPhone:
[1] [2]
[3] [4]
[5] [6]
[7] [8]
iPad Pro
[1] [2][3] [4]
[5] [6] [7] [8]
iPad Mini
[1] [2][3]
[4] [5] [6]
[7] [8]
WOW no help? can someone please tell us what's going on?