Post

Replies

Boosts

Views

Activity

Data not load if FetchResults in init() methods
If I use the following code, the project works normal. let listRequest = FetchRequest<ReminderList>(entity: ReminderList.entity(), sortDescriptors: [NSSortDescriptor(key: "title", ascending: true)]) var lists: FetchedResults<ReminderList>  {         return listRequest.wrappedValue     } But if I put lists variable in init() method (the following), the data not load. I don't know why. let listRequest = FetchRequest<ReminderList>(entity: ReminderList.entity(), sortDescriptors: [NSSortDescriptor(key: "title", ascending: true)]) var lists: FetchResults<ReminderList> init() { self.lists = listRequest.wrappedValue }
1
0
601
Sep ’21
Unable to compile in playground in Xcode 12 but compiles normally in Playground APP
Newest Xcode 12(12A7209) updating from App Store, catalina 10.15.6 The following simple codes could not run normally in playground in Xcode. Get the following message: error: Execution was interrupted, reason: signal SIGABRT. import Foundation import SwiftUI import PlaygroundSupport struct ContentView: View {     let appleProducts: Array&lt;String&gt; = ["iPod", "iPhone", "Macbook", "Macbook Pro", "Mac Pro"]     var body: some View {         ScrollView(.horizontal, showsIndicators: false) {             HStack {                 ForEach(0..&lt;5) {                     Text("\($0)")                 }             }         }     } } PlaygroundPage.current.setLiveView(ContentView())
3
0
1.6k
Sep ’20