Post

Replies

Boosts

Views

Activity

Reply to dSYM using xcodebuild
A .app bundle is not an executable, it is a folder with a specific structure. The executable code is in the bundle's Contents/MacOS directory. You don't want to add anything to that. You could put the symbol file into the bundle you distribute to users, but there is really no reason to do so. It is just dead weight to users, it is only useful to you. If you really want to put it into the bundle, you could copy it to some location in the bundle before signing and notarization. You'd do this by adding a post-build script to the Build Phases of your target in Xcode. A more reasonable approach is to simply archive the .dSYM files for every release you make, and use the appropriate dSYM when you receive a crash log. You can symbolicate the crash logs by hand or using Xcode. See https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’23
Reply to WWDC2023 "Support external cameras in your iPadOS app" presentation sample code
I haven't found the modified sample, but you can download the original code (linked in the WWDC video description) and modify it by following the instructions in the video. At least the slide showing how to preferentially detect and use an external camera is visible for a few seconds, I haven't bothered with the rest yet (which deal with hot plugging etc). It is a couple of lines of code to changes to get a picture from your external camera.
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’23
Reply to Problem when working with .onChange and .onAppear modifier
you haven't shown code complete enough for anyone to reproduce your problem. Try to reduce the problem to a minimum (maybe in a new project), then repost if need be. You'll probably find that you'll figure it out yourself by performing the reduction. What does "showAlert" do? What do you mean by "the issue is in the .onAppear modifier"? It doesn't compile, it is never executed, it behaves in some other way you don't expect - what?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’23
Reply to How to update macOS Beta on VM devices
why are you using a VM, and what are you testing with it, and how? I gave up on using VMs because of the inability to sign into iCloud on a VM, and because it really didn't seem to save any time. I wanted to test the first-time-install experience for our software, which seems impossible to replicate without starting with a new OS and a new user account. It seems to take just as long to reinstall the OS on a VM as it does to reinstall the OS on a physical partition. So that's what I do now - I install beta OSs on a partition of an external drive, and boot a second laptop from that (so that I can continue to use my development machine for other tasks like email and Slack). I often need to debug behavior on the new OS, so I have to install Xcode on that new OS, which also takes its sweet time. I put the beta OS on an external disk, and use a second laptop booted from that disk as my test machine. I'd really like to hear how other people are using VMs for testing their software, and how that experience is better than using a separate Mac and/or a separate boot partition.
Jul ’23
Reply to AppleScript. How do I get a list of all files in all subfolders without any conditions?
something like this tell application "Finder" get entire contents of alias "Users:username:Documents:somefolder" end tell but be warned that if somefolder is large, this will take a very long time. This asks the Finder to do the work on behalf of your script. The Finder doesn't show hidden files, so they don't appear in the entire contents result. There's a post here which uses System Events to do the same thing, with more code, but much quicker (and you'd have to filter out invisible files yourself) https://www.macscripter.net/t/getting-all-files-list-of-directory-and-of-its-subdirectories/71573/4 Did you search for "AppleScript list files and folders"? It wasn't difficult to find these options. Perhaps you did find them but were not happy with the result in your application? If so, please describe what exactly you did try to do, and how it fell short of your expectations.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’23
Reply to How to implement drag and drop of SF Symbols within a SwiftUI grid?
the 'drop' part of a DragGesture can be handled by the DragGesture.onEnded closure. In your .onChanged closure you can figure out where the drag is currently (value.location), so you could highlight legal destinations. In your .onEnded closure you figure out whether the move was legal and update your model accordingly. Your question is a bit broad in scope. Try to narrow it down to something where you can show a piece of self-contained code, and explain what you expect, and what actually happens.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to When to use utf8 vs utf16 vs ascii character codes?
If you're doing this for a user-entered string, don't worry about how they're encoded. CNPhoneNumber.stringValue is of type String A String is a collection of Characters You could iterate through the String by hand, but it is awkward. Swift offers compactMap, which will give you an array of single-character strings. A new String can be created from this Array. for example let likeAPhoneNumber = "(451)∕234-141😃0" let newNumberArray = likeAPhoneNumber.compactMap { $0.isNumber ? $0 : nil } let newNumber = String(newNumberArray) print (newNumber)prints 4512341410 None of this is high-performance, because iterating through a Unicode string is non-trivial.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to dSYM using xcodebuild
A .app bundle is not an executable, it is a folder with a specific structure. The executable code is in the bundle's Contents/MacOS directory. You don't want to add anything to that. You could put the symbol file into the bundle you distribute to users, but there is really no reason to do so. It is just dead weight to users, it is only useful to you. If you really want to put it into the bundle, you could copy it to some location in the bundle before signing and notarization. You'd do this by adding a post-build script to the Build Phases of your target in Xcode. A more reasonable approach is to simply archive the .dSYM files for every release you make, and use the appropriate dSYM when you receive a crash log. You can symbolicate the crash logs by hand or using Xcode. See https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to WWDC2023 "Support external cameras in your iPadOS app" presentation sample code
I haven't found the modified sample, but you can download the original code (linked in the WWDC video description) and modify it by following the instructions in the video. At least the slide showing how to preferentially detect and use an external camera is visible for a few seconds, I haven't bothered with the rest yet (which deal with hot plugging etc). It is a couple of lines of code to changes to get a picture from your external camera.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to Problem when working with .onChange and .onAppear modifier
you haven't shown code complete enough for anyone to reproduce your problem. Try to reduce the problem to a minimum (maybe in a new project), then repost if need be. You'll probably find that you'll figure it out yourself by performing the reduction. What does "showAlert" do? What do you mean by "the issue is in the .onAppear modifier"? It doesn't compile, it is never executed, it behaves in some other way you don't expect - what?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23
Reply to How to update macOS Beta on VM devices
why are you using a VM, and what are you testing with it, and how? I gave up on using VMs because of the inability to sign into iCloud on a VM, and because it really didn't seem to save any time. I wanted to test the first-time-install experience for our software, which seems impossible to replicate without starting with a new OS and a new user account. It seems to take just as long to reinstall the OS on a VM as it does to reinstall the OS on a physical partition. So that's what I do now - I install beta OSs on a partition of an external drive, and boot a second laptop from that (so that I can continue to use my development machine for other tasks like email and Slack). I often need to debug behavior on the new OS, so I have to install Xcode on that new OS, which also takes its sweet time. I put the beta OS on an external disk, and use a second laptop booted from that disk as my test machine. I'd really like to hear how other people are using VMs for testing their software, and how that experience is better than using a separate Mac and/or a separate boot partition.
Replies
Boosts
Views
Activity
Jul ’23
Reply to AppleScript. How do I get a list of all files in all subfolders without any conditions?
something like this tell application "Finder" get entire contents of alias "Users:username:Documents:somefolder" end tell but be warned that if somefolder is large, this will take a very long time. This asks the Finder to do the work on behalf of your script. The Finder doesn't show hidden files, so they don't appear in the entire contents result. There's a post here which uses System Events to do the same thing, with more code, but much quicker (and you'd have to filter out invisible files yourself) https://www.macscripter.net/t/getting-all-files-list-of-directory-and-of-its-subdirectories/71573/4 Did you search for "AppleScript list files and folders"? It wasn't difficult to find these options. Perhaps you did find them but were not happy with the result in your application? If so, please describe what exactly you did try to do, and how it fell short of your expectations.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to How to implement drag and drop of SF Symbols within a SwiftUI grid?
the 'drop' part of a DragGesture can be handled by the DragGesture.onEnded closure. In your .onChanged closure you can figure out where the drag is currently (value.location), so you could highlight legal destinations. In your .onEnded closure you figure out whether the move was legal and update your model accordingly. Your question is a bit broad in scope. Try to narrow it down to something where you can show a piece of self-contained code, and explain what you expect, and what actually happens.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to When to use utf8 vs utf16 vs ascii character codes?
If you're doing this for a user-entered string, don't worry about how they're encoded. CNPhoneNumber.stringValue is of type String A String is a collection of Characters You could iterate through the String by hand, but it is awkward. Swift offers compactMap, which will give you an array of single-character strings. A new String can be created from this Array. for example let likeAPhoneNumber = "(451)∕234-141😃0" let newNumberArray = likeAPhoneNumber.compactMap { $0.isNumber ? $0 : nil } let newNumber = String(newNumberArray) print (newNumber)prints 4512341410 None of this is high-performance, because iterating through a Unicode string is non-trivial.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23