Post

Replies

Boosts

Views

Activity

Reply to Run identical UI/Unit tests on different build targets
I discovered this nugget of Apple Documentation. It visualises how the scheme is the link specifying which build target is used by the test target. Unfortunately this doesn't seem to be the case. The host application field in the test target (general tab) appears to be the main determinator. So my assumptions above seem to be correct, and you can be easily be misled into assuming one build target is used whereas in fact another target is used. Tip: Include a screenshot of the about page of your app/clip/widget to avoid being misled.
Nov ’24
Reply to NSCocoaErrorDomain 513
Solved. I'm not sure where or how Sandbox is selected as a capability. I'd much rather it wasn't. But my problem was that User Selected File (see screenshot above) was specified as read/write in the release tab, but none in the debug tab.
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’24
Reply to NSCocoaErrorDomain 513
I'm also getting a 513 error no matter what I code. I even tried using chatGTP and Harmony and Copilot generated code. All to no avail. Here's the copilot code (as it seemed better to me) func copilotCreateTheNewDirectory(in downloadsURL: URL) { guard downloadsURL.startAccessingSecurityScopedResource() else { let errorMessage = "Failed to access the selected location" showError = true return } defer { downloadsURL.stopAccessingSecurityScopedResource() } let newDir = "myShinyNewDir" let fileManager = FileManager.default let newDirectoryURL = downloadsURL.appendingPathComponent(newDir) do { try fileManager.createDirectory( at: newDirectoryURL, withIntermediateDirectories: false, attributes: nil ) } catch { let errorMessage = "Failed to create directory: \(error.localizedDescription)" showError = true } } } I tried using Swift5 instead of Swift6 and that failed, too. I tried in Documents and Downloads locations - all failed. Here are my App Sandbox settings: Xcode: Version 16.0 (16A242d) MacOS: Sequoa 15.0.1
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’24
Reply to Struggling with Swift Gesture/Observation
I compiled this using Xcode 16RC 16A242 (instead of 15) and it now just about works. In iPadOS 18RC it works perfectly. In iOS 17.6.1 the swipe does not react when started from on top of the button but the showTab2 property does not change either so it remains consistent. It seems this is a problem in Xcode 15 but it has been fixed in Xcode 16 as Sydney 🙏 suggested. PS: 🏆Kudus to Xcode Cloud for making this test so easy to perform. I'd never used it before and it was truly simple to onboard.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to Struggling with Swift Gesture/Observation
Hi Sydney, Xcode Version 15.4 (15F31d) Swift 5 (according to the build settings) I'm surprised, but can't figure yet how to update to 5.1. The code is running on the simulator (iPhone 15) and also iPadOS 18.0 (22A3354) iPad Air and iOS 17.6.1 on an iPhone 13 Pro. I checked all gesture attributes and couldn't find anything dodgy about them. Here's the video: https://youtube.com/shorts/SVlESw5nGX0?si=5JCUgu2iYBCh9Smk Thanks for your interest, Alan
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to How to preview a custom View that takes bindings as inputs in its initializer?
I used Rob the Artist's solution in a different context and it worked perfectly. I was struggling with how to inject a @Namespace in a class that required initialisation into the preview. I'm a newbie so much appreciated the simplicity of the solution. #Preview { struct RectButtonPreview: View { @Namespace var slideLevel var body: some View { RectButtonView(buttonCol: .blue, selected: true) .environment(SlideAnimations(slideLevel: slideLevel)) } } return RectButtonPreview() }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to How to create a native visionOS App archive using a MacBook
Here's the nub... The scheme does not directly include a reference to the platform used, but it does directly reference the Targets config, which determines the platform used. I had assumed that I select the Target by placing the cursor on the Targets config when building the archive, but this is irrelevant 🤦‍♂️ And the Targets config used is specified in the Builds tab, not the archive tab (where I'd expected it) Such a simple solution - now I finally understand the relation between Targets, Schemes and the builds.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’24
Reply to Run identical UI/Unit tests on different build targets
I discovered this nugget of Apple Documentation. It visualises how the scheme is the link specifying which build target is used by the test target. Unfortunately this doesn't seem to be the case. The host application field in the test target (general tab) appears to be the main determinator. So my assumptions above seem to be correct, and you can be easily be misled into assuming one build target is used whereas in fact another target is used. Tip: Include a screenshot of the about page of your app/clip/widget to avoid being misled.
Replies
Boosts
Views
Activity
Nov ’24
Reply to NSCocoaErrorDomain 513
Solved. I'm not sure where or how Sandbox is selected as a capability. I'd much rather it wasn't. But my problem was that User Selected File (see screenshot above) was specified as read/write in the release tab, but none in the debug tab.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to NSCocoaErrorDomain 513
I'm also getting a 513 error no matter what I code. I even tried using chatGTP and Harmony and Copilot generated code. All to no avail. Here's the copilot code (as it seemed better to me) func copilotCreateTheNewDirectory(in downloadsURL: URL) { guard downloadsURL.startAccessingSecurityScopedResource() else { let errorMessage = "Failed to access the selected location" showError = true return } defer { downloadsURL.stopAccessingSecurityScopedResource() } let newDir = "myShinyNewDir" let fileManager = FileManager.default let newDirectoryURL = downloadsURL.appendingPathComponent(newDir) do { try fileManager.createDirectory( at: newDirectoryURL, withIntermediateDirectories: false, attributes: nil ) } catch { let errorMessage = "Failed to create directory: \(error.localizedDescription)" showError = true } } } I tried using Swift5 instead of Swift6 and that failed, too. I tried in Documents and Downloads locations - all failed. Here are my App Sandbox settings: Xcode: Version 16.0 (16A242d) MacOS: Sequoa 15.0.1
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to Struggling with Swift Gesture/Observation
I compiled this using Xcode 16RC 16A242 (instead of 15) and it now just about works. In iPadOS 18RC it works perfectly. In iOS 17.6.1 the swipe does not react when started from on top of the button but the showTab2 property does not change either so it remains consistent. It seems this is a problem in Xcode 15 but it has been fixed in Xcode 16 as Sydney 🙏 suggested. PS: 🏆Kudus to Xcode Cloud for making this test so easy to perform. I'd never used it before and it was truly simple to onboard.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Struggling with Swift Gesture/Observation
Hi Sydney, Xcode Version 15.4 (15F31d) Swift 5 (according to the build settings) I'm surprised, but can't figure yet how to update to 5.1. The code is running on the simulator (iPhone 15) and also iPadOS 18.0 (22A3354) iPad Air and iOS 17.6.1 on an iPhone 13 Pro. I checked all gesture attributes and couldn't find anything dodgy about them. Here's the video: https://youtube.com/shorts/SVlESw5nGX0?si=5JCUgu2iYBCh9Smk Thanks for your interest, Alan
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to How to preview a custom View that takes bindings as inputs in its initializer?
I used Rob the Artist's solution in a different context and it worked perfectly. I was struggling with how to inject a @Namespace in a class that required initialisation into the preview. I'm a newbie so much appreciated the simplicity of the solution. #Preview { struct RectButtonPreview: View { @Namespace var slideLevel var body: some View { RectButtonView(buttonCol: .blue, selected: true) .environment(SlideAnimations(slideLevel: slideLevel)) } } return RectButtonPreview() }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to How to create a native visionOS App archive using a MacBook
Here's the nub... The scheme does not directly include a reference to the platform used, but it does directly reference the Targets config, which determines the platform used. I had assumed that I select the Target by placing the cursor on the Targets config when building the archive, but this is irrelevant 🤦‍♂️ And the Targets config used is specified in the Builds tab, not the archive tab (where I'd expected it) Such a simple solution - now I finally understand the relation between Targets, Schemes and the builds.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to How to create a native visionOS App archive using a MacBook
It is already the target Supported destination. It's also in the included in the project Deployment And it's in the target architecture Just now I added it to the Targeted Device Families for vision OS deployment but that didn't help. There are so many different tabs and settings... is there a way of getting this in xml/json to pinpoint the entry that is missing?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’24