Post

Replies

Boosts

Views

Activity

Reply to Unable to simultaneously satisfy constraints using versions 26.1
I'm working through various coding tutorials and have encountered the same warning numerous times. First, I must say that the symbolic breakpoint message is most unhelpful as I am developing in SwiftUI, not UIKit and have no idea where to place that breakpoint. Second, I did some experiments and found that one place the warning was coming from using the Button initializer with titleKey and systemImage parameters. A Button without systemImage did not cause the warning. I found that if instead I used the Button initializer with action and label parameters and added an Image using systemName for the label, there was no warning.
3w
Reply to Swift Test Parameterized Test
I wrote a simple test import Testing func target(value: Int) -> Int { value + 1 } struct ParameterizedTestTests { @Test(arguments: zip([1,2,3,4,5],[2,3,4,5,5])) func test1(x: Int, r: Int) async throws { #expect(target(value: x) == r) } } Note that the last test case should fail. I've run it numerous times, including shutting down Xcode and restarting and the test works, reporting the failure for the last test case. I went back into my original code and recreated problem test (I had rewritten the test to not use parameters). It was still acting up, but then I noticed in a previous parameterized test that the test was expecting UInt16 parameters, but the parameters given were Int (i.e. no type specified, which Swift defaults to Int). When I changed them to UInt16, it cleared things up. However, unlike a normal function call which complains if the type of the arguments don't match the type of the parameters, parameterized tests don't report a mismatch.
Feb ’25
Reply to SwiftData One To Many
Thanks for the reply. The issue was my understanding of how relationships work in SwiftData. I thought I was deleting the relationship. Here's my corrected deleteFavorites method. private func deleteFavorites(indexes: IndexSet) { for index in indexes { let friend = movie.favoritedBy[index] friend.favoriteMovie = nil } do { try context.save() } catch { fatalError("Could not create ModelContainer: \(error)") } } I had to add the context.save to get the view to update when no friends favorited a movie.
Feb ’25
Reply to Xcode Open File from Previous Project for Reference
I found one way, but it's cumbersome. I split the editor window, delete the file that's displayed on the right (it's the same as the one on the left), then drag the reference file's icon from the Finder to the right side editor. Is there a better way? I would hope that there is an Open option under the File menu, but that wants to open the previous project as a second project
Feb ’25
Reply to Date constant from year, month, day
Claude31, Thanks for the reply. It works. I figured it had something to do with calendars and timezones, but I couldn't find a simple example of how to put it all together. I'll keep your function handy. I live in the US Eastern Time Zone, so when I put in a date in GMT, it ended up the previous day, which makes sense. I changed the timezone to EST and then the date was correct. I'm used to Python which has both naive and aware (of time zone) date time values. Apparently, Swift's Date object is aware. Does Swift have a naive date time concept?
Topic: App & System Services SubTopic: General Tags:
Feb ’25
Reply to Do I have to be a paid developer to develop MacOS programs for personal use?
Here is the entitlements output: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.app-sandbox</key> <true/> <key>com.apple.security.files.downloads.read-only</key> <true/> <key>com.apple.security.get-task-allow</key> <true/> <key>com.apple.security.network.client</key> <true/> <key>com.apple.security.network.server</key> <true/> <key>com.apple.security.personal-information.location</key> <true/> </dict> </plist> The certificate shows not valid before date of April 30, 2022 and a not valid after date of April 30, 2023.
Topic: Code Signing SubTopic: General Tags:
May ’22
Reply to Do I have to be a paid developer to develop MacOS programs for personal use?
The error happened again today on my old 2014 MBA which is limited to Big Sur. It happened after the upgrade to 11.6. This time, whenever I try to start the app, I get a dump. Maybe it will help diagnose things: Process: FCC Database [1004] Path: /Applications/FCC Database.app/Contents/MacOS/FCC Database Identifier: FCC Database Version: ??? Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: FCC Database [1004] User ID: 501 Date/Time: 2022-05-16 18:29:20.133 -0400 OS Version: macOS 11.6.6 (20G624) Report Version: 12 Anonymous UUID: DAF76B35-38D8-E814-26F9-9397EDA649C7 Time Awake Since Boot: 1200 seconds System Integrity Protection: enabled Crashed Thread: 0 Exception Type: EXC_CRASH (Code Signature Invalid) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace CODESIGNING, Code 0x1 kernel messages: VM Regions Near 0 (cr2): --> __TEXT 105451000-1054d9000 [ 544K] r-x/r-x SM=COW Thread 0 Crashed: 0 0x000000010fe0a000 _dyld_start + 0 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000 rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x00007ffeea7aebc8 r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000 r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000 rip: 0x000000010fe0a000 rfl: 0x0000000000000200 cr2: 0x0000000000000000 Logical CPU: 0 Error Code: 0x00000000 Trap Number: 0 Thread 0 instruction stream not available. Thread 0 last branch register state not available. Binary Images: 0x105451000 - 0x1054d8fff +??? (0) <B8C214B1-A5BD-3CCD-ADB5-E79B13206011> (null) 0x10fe09000 - 0x10fea4fff + (852.2) <2E400646-C53E-329B-8301-2478447C89F8> External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 0 thread_create: 0 thread_set_state: 0 VM Region Summary: ReadOnly portion of Libraries: Total=2480K resident=0K(0%) swapped_out_or_unallocated=2480K(100%) Writable regions: Total=8416K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8416K(100%) VIRTUAL REGION REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= STACK GUARD 56.0M 1 Stack 8192K 1 VM_ALLOCATE 8K 2 __DATA 272K 4 __DATA_CONST 48K 2 __LINKEDIT 1328K 3 __TEXT 1168K 2 =========== ======= ======= TOTAL 66.8M 15 Model: MacBookAir6,1, BootROM 433.120.6.0.0, 2 processors, Dual-Core Intel Core i5, 1.4 GHz, 4 GB, SMC 2.12f143 Graphics: kHW_IntelHD5000Item, Intel HD Graphics 5000, spdisplays_builtin Memory Module: BANK 0/DIMM0, 2 GB, DDR3, 1600 MHz, 0x02FE, 0x45424A3230554638454455302D474E2D4620 Memory Module: BANK 1/DIMM0, 2 GB, DDR3, 1600 MHz, 0x02FE, 0x45424A3230554638454455302D474E2D4620 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x117), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1680.9) Bluetooth: Version 8.0.5d7, 3 services, 19 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 Serial ATA Device: APPLE SSD TS0128F, 121.33 GB USB Device: USB 3.0 Bus USB Device: BRCM20702 Hub USB Device: Bluetooth USB Host Controller Thunderbolt Bus: MacBook Air, Apple Inc., 23.6
Topic: Code Signing SubTopic: General Tags:
May ’22
Reply to How to keep a Settings scene from slowing a Mac app?
Okay, this makes no sense, or I am obviously missing something in my understanding of SwiftUI. If I declare my Settings scene as: Settings { FCCDatabaseSettings(fccData: fccData) } Where FCCDatabaseSettings is a view and fccData is an @StateObject, the map does not drag smoothly. If, OTOH, I declare it as: Settings { SettingsWrapper(fccData: fccData) } Where SettingsWrapper is a view that simply calls FCCDatabaseSettings struct SettingsWrapper: View { @ObservedObject var fccData: FCCData var body: some View { FCCDatabaseSettings(fccData: fccData) } } The map drags smoothly. What is going on?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22