Post

Replies

Boosts

Views

Activity

you don't have permission to view it
there are other unresolved posts on this issue but maybe mine is solvable. I copied the files I contributed from a working project to a new project using the finder (drag and drop). So I did not copy entitlements. Xcode automatically added the files to the project just fine. My app uses data on a removable drive, or used to, because I now get the error above. At one point I copied the product app to the desktop hoping to get the permissions alert window, but it never came. Oddly, in System Settings/Privacy & Security/Files & Folders my "new" app is listed with "Removable Volumes" slider = on. The file permissions (unix-like) on that drive haven't changed between projects and allow everyone to read. How can I fix this?
3
0
529
Dec ’24
SceneView selective draw since concurrency
I have used SceneKit for several years but recently have a problem where a scene with fewer than 50 nodes is partially drawn, i.e., some nodes are, some aren't, and greater than 50 nodes are always draw correctly. This seems to have happened since concurrency was introduced. (w.r.t. concurrency, I had been using DispatchQueue successfully before then.) Since all nodes (few or many) are constructed and implemented by the same functions etc. I'm baffled. When I print the node hierarchy all nodes are present whether few or many. SceneView() has [.rendersContinually] option selected. Every node created (few or many) has .opacity = 1.0, .isHidden = false I haven't tried setting-back the compiler version as that is not a long term solution, and I know the same code worked fine then.
8
0
858
Feb ’25
Menu bar and Help window
by selecting Help under my Help menu item or cmd-h no window appears until the menu bar is touched. myApp.swift file: import SwiftUI import QuickLook @main struct myApp: App { @Environment(\.openWindow) var openWindow @State var helpURL: URL? = nil var body: some Scene { WindowGroup { ContentView() } .commandsReplaced { CommandGroup(before: .appInfo) { Button("Quit") { NSApp.terminate(nil) }.keyboardShortcut("q") } CommandGroup(before: .help) { //FIXME: only shows help if the menu bar is touched again. Button("Help") { helpURL = Bundle.main.url(forResource: "help", withExtension: "txt") } .keyboardShortcut("h") .quickLookPreview($helpURL) } } } } How should this be coded for proper action? Thanks
1
0
90
Jul ’25
Who's on top? Swift, nonSwiftUI
My SceneView hides part of my NSStackView's TextFields. I don't see anything in the inspector for the z dimension. How can I ensure the StackView is on top, i.e., wholly visible? I don't want to shove views around to "fit them in". They must overlap. Indeed, I may wish to have all TextFields, etc. overlay the SceneView in the future, but that's a different subject. I know this would be easy in SwiftUI, but...
2
0
676
Aug ’21
NSOpenPanel not closing after OK button
I launch the following runSavePanel() from, e.g., @IBAction func JSONall(_ sender: NSButton) {         if !nsPanelActivatedThisSessionForSandbox {         nsPanelActivatedThisSessionForSandbox = true runSavePanel() } ... } where var nsPanelActivatedThisSessionForSandbox = false is declared as a global in the AppDelegate.swift file and is intended to prevent repeated user prompting as the program creates many files but needs sandbox acknowledgment at least once. The problem behavior is that upon clicking the OK button, the app merrily creates the files in the chosen directory but the modal window stays open until the app is done creating files (around ten minutes). Here is my runSavePanel() and its (empty) delegate:     func runSavePanel() {         let defaults = UserDefaults.standard         let savePanel = NSSavePanel()         savePanel.canCreateDirectories     = true         savePanel.canSelectHiddenExtension = false         savePanel.showsHiddenFiles         = false         //        savePanel.allowedFileTypes         = ["JSON", "csv"]                            //  deprecated         savePanel.directoryURL             = defaults.url(forKey: "fileDirectoryPref")         let delegate = OpenSavePanelDelegate()      //  cannot consolidate with next line         savePanel.delegate = delegate         let result = savePanel.runModal()         if result == NSApplication.ModalResponse.OK {             if savePanel.url != nil {                 do {                     try savePanel.delegate!.panel!(savePanel, validate: savePanel.url!)                     defaults.set(savePanel.url, forKey: "fileDirectoryPref")                     //        defaults.set(savePanel.url, forKey: "NSNavLastRootDirectory")   //  does not write                 } catch {                     print("\(result) ViewController Structures.swift:739 runSavePanel()")                 }             }         }     }          class OpenSavePanelDelegate: NSObject, NSOpenSavePanelDelegate {         func panel(_ sender: Any, validate url: URL) throws {             /*  In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure.              You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.              */ //            throw CustomError.InvalidSelection         }     }      //    enum CustomError: LocalizedError { //        case InvalidSelection // //        var errorDescription: String? { //            get { //                return "\(CustomError.InvalidSelection)" //            } //        } //    } Idk how to stop the double spacing when pasting my code. Sorry. The delegate is a requirement but I don't know how to configure it. The app doesn't generate errors... or at least it allows the desired output. Is the delegate supposed to terminate the modal window somehow?
8
0
1.5k
Sep ’21
Warning about truncatingRemainder
it may not deliver what you expect. For example: if you are using NASA/JPL/Standish equations of heliocentric planetary motion, it requires: "3. Modulus the mean anomaly (M) so that -180deg<=M<=+180deg and then obtain the eccentric anomaly, E, from the solution of Kepler's equation..." If you attempt to use the Swift "Modulo operator, %" you'll get the Xcode directive to use truncatingRemainder instead. Which IS better than % because of this note in "The Swift Programming Language (Swift 5.3)": "“NOTE The remainder operator (%) is also known as a modulo operator in other languages. However, its behavior in Swift for negative numbers means that, strictly speaking, it’s a remainder rather than a modulo operation.” Excerpt From The Swift Programming Language (Swift 5.3) Apple Inc. https://books.apple.com/us/book/the-swift-programming-language-swift-5-5/id881256329 This material may be protected by copyright. But you should try truncatingRemainder in your playground! Let: 0deg = 12 O'clock, 180/-180deg = 6 O'clock, -90deg = 9 O'clock and +90deg = 3 O'clock Now run this on your playground: let M = -181.25 var M180 = M while M180 > 180.0 { M180 -= 360.0 } while M180 < -180.0 { M180 += 360.0 } print("M = \(M)\t\tM180 = \(M180)\t\tM.truncatingRemainder(dividingBy: 180.0) = \(M.truncatingRemainder(dividingBy: 180.0))\t\tM.truncatingRemainder(dividingBy: 360.0) = \(M.truncatingRemainder(dividingBy: 360.0))") and you'll get this result: M = -181.25        M180 = 178.75 M.truncatingRemainder(dividingBy: 180.0) = -1.25 M.truncatingRemainder(dividingBy: 360.0) = -181.25 Thus, truncatingRemainder(dividingBy: 180.0) puts your planet 180deg away from where it should be, while M180 keeps the planets moving without quantum leaps.
0
0
854
Jan ’22
format printed SIMD3's
I print a lot of SIMD3 vectors to the debugger area in Xcode. Some vector-elements have prefixed signs and some values are longer than others. I would like the printed vectors to align as they did in my old days of Fortran. The SIMD3 members are scalars which can't be cast as Double ( I know how to format output for Double) or even as NSNumber. Something akin to a NumberFormatter for vectors would be the objective, but I don't see how to do it. Scalars are wierd and (helpful) documentation sparse.
5
0
849
Jan ’22
macOS load file progress indication
My app generates many files as large as 12 GB (limited by memory) and I use Picker() to select which to reload with FileManager(). The larger files can take three minutes to load (M2 Mini Pro) and it would be nice to have progress indication like Apple's App Store downloads with the mini spinner, file size and bytes loaded. From what I've read in "Developer Documentation", I must use a URLdelegate instance I have created, not the shared delegate, when effecting a URL download. "Downloading files in the Background" shows iOS code, not macOS, and it also uses a "shared" delegate. A post, here, dated years ago said what I seek is not possible and I have not found recent sample code to show otherwise. Can anyone shed light on this? Thanks
1
0
626
Feb ’24
SceneView camera viewpoint restoration
SceneKit SCNScene MacOS 15.1 Xcode 16.0 SceneView(scene: , options:[autoenablesDefaultLighting, allowsCameraContol] there is: .rootNode.cameraNode .rootNode.camera .rootNode.nestedChildNodes each with its own animation when the object is animated and dragged by mouse to change the view point, I can't return the view to the previous view. I have reinstated a clone of the original cameraNode, positions of all childNodes, removed and re-activated all animations... in vain. I have also cloned, removed and replaced .rootNode.camera, in vain. The documentation states the camera is "attached" to an SCNNode but does not say how. I make no declaration to associate .rootNode.cameraNode to .rootNode.camera yet if either is absent there is no scene to view. What am I missing? Thanks
1
0
665
Nov ’24
SCNGeometry and .copy()
Up to now I have created multiple new SCNNodes using an instance of SCNGeometry and it was OK that they all had the same appearance. Now I want variety and when I make a copy of that instance using: let newGeo = myGeoInstance.copy() as! SCNGeometry (must be force cast because copy() -> any?) all elements are verified present. :-) Likewise: node.geometry?.replaceMaterial(at: index, with: myNewMaterial) is verified to correctly change the material(s) at the correct index(s). The only problem is the modified "teapot" is not visible, and yes I have set node.isHidden = false. Has anyone experienced this? In the old days reversing the verts was a solution. In desperation I tried that. |-(
6
0
887
Dec ’24
you don't have permission to view it
there are other unresolved posts on this issue but maybe mine is solvable. I copied the files I contributed from a working project to a new project using the finder (drag and drop). So I did not copy entitlements. Xcode automatically added the files to the project just fine. My app uses data on a removable drive, or used to, because I now get the error above. At one point I copied the product app to the desktop hoping to get the permissions alert window, but it never came. Oddly, in System Settings/Privacy & Security/Files & Folders my "new" app is listed with "Removable Volumes" slider = on. The file permissions (unix-like) on that drive haven't changed between projects and allow everyone to read. How can I fix this?
Replies
3
Boosts
0
Views
529
Activity
Dec ’24
SceneView selective draw since concurrency
I have used SceneKit for several years but recently have a problem where a scene with fewer than 50 nodes is partially drawn, i.e., some nodes are, some aren't, and greater than 50 nodes are always draw correctly. This seems to have happened since concurrency was introduced. (w.r.t. concurrency, I had been using DispatchQueue successfully before then.) Since all nodes (few or many) are constructed and implemented by the same functions etc. I'm baffled. When I print the node hierarchy all nodes are present whether few or many. SceneView() has [.rendersContinually] option selected. Every node created (few or many) has .opacity = 1.0, .isHidden = false I haven't tried setting-back the compiler version as that is not a long term solution, and I know the same code worked fine then.
Replies
8
Boosts
0
Views
858
Activity
Feb ’25
SwiftCharts to add candlestick and OHLC types to their stable?
I didn't find a suggestion box on Swift's website so I'll post it here. SwiftCharts are great but limited. I need more data on a single chart. Candlestick and OHLC type charts would be an excellent addition. Hopefully, influencers from Apple can make that happen. Thanks.
Replies
3
Boosts
0
Views
309
Activity
Jun ’25
Menu bar and Help window
by selecting Help under my Help menu item or cmd-h no window appears until the menu bar is touched. myApp.swift file: import SwiftUI import QuickLook @main struct myApp: App { @Environment(\.openWindow) var openWindow @State var helpURL: URL? = nil var body: some Scene { WindowGroup { ContentView() } .commandsReplaced { CommandGroup(before: .appInfo) { Button("Quit") { NSApp.terminate(nil) }.keyboardShortcut("q") } CommandGroup(before: .help) { //FIXME: only shows help if the menu bar is touched again. Button("Help") { helpURL = Bundle.main.url(forResource: "help", withExtension: "txt") } .keyboardShortcut("h") .quickLookPreview($helpURL) } } } } How should this be coded for proper action? Thanks
Replies
1
Boosts
0
Views
90
Activity
Jul ’25
how to set Simulator screenshots directory
running my Xcode app in Simulator: screenshots are sent to Library/Developer/CoreSimulator/Devices followed by the cryptic code for the device ( given in /Library/Developer/CoreSimulator/Devices/device_set.plist ), a subdirectory then the PNG file. This is very inconvenient. How to I set the desired directory?
Replies
3
Boosts
0
Views
168
Activity
Jul ’25
Who's on top? Swift, nonSwiftUI
My SceneView hides part of my NSStackView's TextFields. I don't see anything in the inspector for the z dimension. How can I ensure the StackView is on top, i.e., wholly visible? I don't want to shove views around to "fit them in". They must overlap. Indeed, I may wish to have all TextFields, etc. overlay the SceneView in the future, but that's a different subject. I know this would be easy in SwiftUI, but...
Replies
2
Boosts
0
Views
676
Activity
Aug ’21
NSOpenPanel not closing after OK button
I launch the following runSavePanel() from, e.g., @IBAction func JSONall(_ sender: NSButton) {         if !nsPanelActivatedThisSessionForSandbox {         nsPanelActivatedThisSessionForSandbox = true runSavePanel() } ... } where var nsPanelActivatedThisSessionForSandbox = false is declared as a global in the AppDelegate.swift file and is intended to prevent repeated user prompting as the program creates many files but needs sandbox acknowledgment at least once. The problem behavior is that upon clicking the OK button, the app merrily creates the files in the chosen directory but the modal window stays open until the app is done creating files (around ten minutes). Here is my runSavePanel() and its (empty) delegate:     func runSavePanel() {         let defaults = UserDefaults.standard         let savePanel = NSSavePanel()         savePanel.canCreateDirectories     = true         savePanel.canSelectHiddenExtension = false         savePanel.showsHiddenFiles         = false         //        savePanel.allowedFileTypes         = ["JSON", "csv"]                            //  deprecated         savePanel.directoryURL             = defaults.url(forKey: "fileDirectoryPref")         let delegate = OpenSavePanelDelegate()      //  cannot consolidate with next line         savePanel.delegate = delegate         let result = savePanel.runModal()         if result == NSApplication.ModalResponse.OK {             if savePanel.url != nil {                 do {                     try savePanel.delegate!.panel!(savePanel, validate: savePanel.url!)                     defaults.set(savePanel.url, forKey: "fileDirectoryPref")                     //        defaults.set(savePanel.url, forKey: "NSNavLastRootDirectory")   //  does not write                 } catch {                     print("\(result) ViewController Structures.swift:739 runSavePanel()")                 }             }         }     }          class OpenSavePanelDelegate: NSObject, NSOpenSavePanelDelegate {         func panel(_ sender: Any, validate url: URL) throws {             /*  In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure.              You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.              */ //            throw CustomError.InvalidSelection         }     }      //    enum CustomError: LocalizedError { //        case InvalidSelection // //        var errorDescription: String? { //            get { //                return "\(CustomError.InvalidSelection)" //            } //        } //    } Idk how to stop the double spacing when pasting my code. Sorry. The delegate is a requirement but I don't know how to configure it. The app doesn't generate errors... or at least it allows the desired output. Is the delegate supposed to terminate the modal window somehow?
Replies
8
Boosts
0
Views
1.5k
Activity
Sep ’21
Warning about truncatingRemainder
it may not deliver what you expect. For example: if you are using NASA/JPL/Standish equations of heliocentric planetary motion, it requires: "3. Modulus the mean anomaly (M) so that -180deg<=M<=+180deg and then obtain the eccentric anomaly, E, from the solution of Kepler's equation..." If you attempt to use the Swift "Modulo operator, %" you'll get the Xcode directive to use truncatingRemainder instead. Which IS better than % because of this note in "The Swift Programming Language (Swift 5.3)": "“NOTE The remainder operator (%) is also known as a modulo operator in other languages. However, its behavior in Swift for negative numbers means that, strictly speaking, it’s a remainder rather than a modulo operation.” Excerpt From The Swift Programming Language (Swift 5.3) Apple Inc. https://books.apple.com/us/book/the-swift-programming-language-swift-5-5/id881256329 This material may be protected by copyright. But you should try truncatingRemainder in your playground! Let: 0deg = 12 O'clock, 180/-180deg = 6 O'clock, -90deg = 9 O'clock and +90deg = 3 O'clock Now run this on your playground: let M = -181.25 var M180 = M while M180 > 180.0 { M180 -= 360.0 } while M180 < -180.0 { M180 += 360.0 } print("M = \(M)\t\tM180 = \(M180)\t\tM.truncatingRemainder(dividingBy: 180.0) = \(M.truncatingRemainder(dividingBy: 180.0))\t\tM.truncatingRemainder(dividingBy: 360.0) = \(M.truncatingRemainder(dividingBy: 360.0))") and you'll get this result: M = -181.25        M180 = 178.75 M.truncatingRemainder(dividingBy: 180.0) = -1.25 M.truncatingRemainder(dividingBy: 360.0) = -181.25 Thus, truncatingRemainder(dividingBy: 180.0) puts your planet 180deg away from where it should be, while M180 keeps the planets moving without quantum leaps.
Replies
0
Boosts
0
Views
854
Activity
Jan ’22
format printed SIMD3's
I print a lot of SIMD3 vectors to the debugger area in Xcode. Some vector-elements have prefixed signs and some values are longer than others. I would like the printed vectors to align as they did in my old days of Fortran. The SIMD3 members are scalars which can't be cast as Double ( I know how to format output for Double) or even as NSNumber. Something akin to a NumberFormatter for vectors would be the objective, but I don't see how to do it. Scalars are wierd and (helpful) documentation sparse.
Replies
5
Boosts
0
Views
849
Activity
Jan ’22
precompiler test for cpu count
I use as many cpu's as I can get with DispatchQueue. How do I test the Mac for cpu count in my code?
Replies
6
Boosts
0
Views
1.6k
Activity
Jul ’22
Apple apps not downloading
My iNet works fine but Numbers.app, Pages.app etc. not downloading.
Replies
1
Boosts
0
Views
599
Activity
Jul ’22
LAPACK/BLAS on Metal
MAGMA API runs on NVIDIA or AMD GPU's via CUDA. Are there plans to code Accelerate for Metal? Thanks
Replies
0
Boosts
0
Views
966
Activity
Jun ’23
macOS load file progress indication
My app generates many files as large as 12 GB (limited by memory) and I use Picker() to select which to reload with FileManager(). The larger files can take three minutes to load (M2 Mini Pro) and it would be nice to have progress indication like Apple's App Store downloads with the mini spinner, file size and bytes loaded. From what I've read in "Developer Documentation", I must use a URLdelegate instance I have created, not the shared delegate, when effecting a URL download. "Downloading files in the Background" shows iOS code, not macOS, and it also uses a "shared" delegate. A post, here, dated years ago said what I seek is not possible and I have not found recent sample code to show otherwise. Can anyone shed light on this? Thanks
Replies
1
Boosts
0
Views
626
Activity
Feb ’24
SceneView camera viewpoint restoration
SceneKit SCNScene MacOS 15.1 Xcode 16.0 SceneView(scene: , options:[autoenablesDefaultLighting, allowsCameraContol] there is: .rootNode.cameraNode .rootNode.camera .rootNode.nestedChildNodes each with its own animation when the object is animated and dragged by mouse to change the view point, I can't return the view to the previous view. I have reinstated a clone of the original cameraNode, positions of all childNodes, removed and re-activated all animations... in vain. I have also cloned, removed and replaced .rootNode.camera, in vain. The documentation states the camera is "attached" to an SCNNode but does not say how. I make no declaration to associate .rootNode.cameraNode to .rootNode.camera yet if either is absent there is no scene to view. What am I missing? Thanks
Replies
1
Boosts
0
Views
665
Activity
Nov ’24
SCNGeometry and .copy()
Up to now I have created multiple new SCNNodes using an instance of SCNGeometry and it was OK that they all had the same appearance. Now I want variety and when I make a copy of that instance using: let newGeo = myGeoInstance.copy() as! SCNGeometry (must be force cast because copy() -> any?) all elements are verified present. :-) Likewise: node.geometry?.replaceMaterial(at: index, with: myNewMaterial) is verified to correctly change the material(s) at the correct index(s). The only problem is the modified "teapot" is not visible, and yes I have set node.isHidden = false. Has anyone experienced this? In the old days reversing the verts was a solution. In desperation I tried that. |-(
Replies
6
Boosts
0
Views
887
Activity
Dec ’24