Post

Replies

Boosts

Views

Activity

Reply to SwiftUI List rows loaded all at once
sure. see the sample here. BuildingView will load all rows (i.e. 1000 instead of 17) struct ContentView: View { @StateObject var store = Store() var body: some View { TabView { // Correct houses.tabItem { Label("Houses", systemImage: "house") } // Wrong? buildings.tabItem { Label("Building", systemImage: "building") } } } var houses: some View { List { ForEach(store.houses) {house in HouseView(house: house) } } } var buildings: some View { List { ForEach(store.buildings) {building in BuildingView(building: building) } } } } struct HouseView: View { let house: House var body: some View { print(house.title) // Only visible will get loaded return Text(house.title) } } struct BuildingView: View { let building: Building var body: some View { print(building.index) // loads all available items return content } @ViewBuilder var content: some View { switch building.kind { case .condo: Text("Condo \(building.index)") case .house: Text("House \(building.index)") case .warehouse: Text("Warehouse \(building.index)") } } }
Aug ’24
Reply to iOS 14 CoreFoundation crash with EXC_BREAKPOINT
For details , see my attached crash log 2024-04-22_14-55-46.3894_+0200-498fa0a5137ba58fc535e918e393ed2c2efa174a.crash The interesting part is in 2 CFNetwork 0x00000001895e6c58 _BrowserCancel(__CFNetServiceBrowser*) + 120 (CFNetServiceBrowser.c:179) which can be opened here: https://opensource.apple.com/source/CFNetwork/CFNetwork-129.18/NetServices/CFNetServiceBrowser.c.auto.html /* static */ void _BrowserCancel(__CFNetServiceBrowser* browser) { CFNetServiceBrowserClientCallBack cb = NULL; CFStreamError error; void* info = NULL; // Retain here to guarantee safety really after the browser release, // but definitely before the callback. CFRetain(browser); // Lock the browser __CFSpinLock(&browser->_lock); // If the browse canceled, don't need to do any of this. if (browser->_trigger) { // Save the callback if there is one at this time. cb = browser->_callback; // Save the error and client information for the callback memmove(&error, &(browser->_error), sizeof(error)); info = browser->_client.info; // Remove the trigger from run loops and modes _CFTypeUnscheduleFromMultipleRunLoops(browser->_trigger, browser->_schedules); // Invalidate the run loop source that got here CFRunLoopSourceInvalidate((CFRunLoopSourceRef)(browser->_trigger)); // Release the trigger now. CFRelease(browser->_trigger); browser->_trigger = NULL; } // Unlock the browser so the callback can be made safely. __CFSpinUnlock(&browser->_lock); // If there is a callback, inform the client of the finish. if (cb) cb((CFNetServiceBrowserRef)browser, 0, NULL, &error, info); // Go ahead and release now that the callback is done. CFRelease(browser); } the CFRunLoopSourceInvalidate causes the crash? There is a lock. But might be not correct?
May ’24
Reply to Why does the iOS app with TLS 1.3 offer SHA-1 as signature algorithm
Hi ! I am using standard URLSession . no custom ATS settings. I can be reproduced with all fresh created apps in Xcode 15. struct ContentView: View { @StateObject var client = NetworkClient() @State var text: String var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text(text) }.task { do { let res = try await client.request() self.text = res } catch {} } .padding() } } class NetworkClient: ObservableObject { func request() async throws -> String { let (data, _) = try await URLSession.shared.data(for: .init(url: .init(string: "https://www.apple.com")!)) return String(data: data, encoding: .utf8) ?? "empty" } }
Oct ’23