Post

Replies

Boosts

Views

Activity

Reply to NavigationSplitView and Lists in Child views
And additionally, in the case without selPriv, I end up getting this warning on device when the selection doesn't work: 2023-09-14 10:44:45.305377-0700 NavSplitView[20843:16029318] [Assert] Collection view focus state got out of sync. Expected <SwiftUI.ListCollectionViewCell: 0x13d050a00; baseClass = UICollectionViewListCell; frame = (116 44; 288 44); layer = <CALayer: 0x600002305540>> to be the current managed subview but found <SwiftUI.ListCollectionViewCell: 0x14d01a000; baseClass = UICollectionViewListCell; frame = (116 44; 288 44); alpha = 0; layer = <CALayer: 0x6000023fa520>>. It doesn't happen when I use the private selection case (but the selection still doesn't highlight).
Sep ’23
Reply to NavigationSplitView and Lists in Child views
As an experiment I tried a private state variable for the selection. Selections are highlighted (but the detail is broken), but as soon as I hook up the onChange, the detail works but the selections fail struct ContentStringX: View { let content = [StringItem(item: "Here"), StringItem(item: "There"), StringItem(item: "Everywhere") ] @Binding var selection : StringItem? @State private var selPriv : StringItem? var body: some View { List(content, selection: $selPriv) { c in NavigationLink(value: c) { Text(c.item) } } .onChange(of: selPriv) { new in selection = selPriv } } }
Sep ’23
Reply to CoreData / SwiftUI List selection question
OK, so I have figured out what was going on in SampleTrip. It turns out that TripListItem includes a NavigationLink so copying that pattern var body: some View { NavigationSplitView { List(players, selection: $selectedPlayer) { player in NavigationLink(value: player) { Text(player.shortName ?? "") } } .navigationTitle("Players") } detail: { if let p = selectedPlayer { Text("detail \(p.shortName ?? "")") } else { Text("detail empty") } } Now works. So in this case, I don't need to pass in id. Any thoughts on whether using the NavigationLink here is the preferred approach? At least part of the mystery is resolved!
Sep ’23
Reply to CoreData / SwiftUI List selection question
The code: @FetchRequest(sortDescriptors: []) private var players: FetchedResults<PlayerEntity> @State private var selectedPlayer : PlayerEntity? var body: some View { NavigationSplitView { List(players, selection: $selectedPlayer) { player in Text(player.shortName ?? "") } .navigationTitle("Players") } detail: { if let player = selectedPlayer { Text("Do Something") } } } The list appears, but is not selectable, and the detail view doesn't get presented. I also tried using the same List/ForEach style of the sample code.
Sep ’23
Reply to Xcode 12 store kit test returning different date formats than actual receipts
I've updated FB8724409 but can't tell if it has been assigned back to Apple. Testing this against Xcode 12B45b running Simulator Version 12.2 (940.16) SimulatorKit 597.13.0.1 CoreSimulator 732.18.0.2 And iOS 14.2 in the simulator, the string in section 12 (creation date) is still formatted with the -0700 format, section 1704 (purchase date) is using the Z format, but the expiration date is still incorrect as well. The purchase date, however, is returning the local time but appending Z, rather than correctly converting the local time to UTC.
Dec ’20