Post

Replies

Boosts

Views

Activity

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
43
1w
httpd.conf syntax to include Homebrew extensions for php and mySQL
I have "http://localhost:8080" showing the index page I've created but php is not handled though an extension is running. Haven't even tried mySQL yet but since there is no reference to it in https.conf the same problem will exist. Homebrew extension running also. https.conf: #PHP was deprecated in macOS 11 and removed from macOS 12 #LoadModule php7_module libexec/apache2/libphp7.so There are no php.so files on my machine and again no mention of mysql What should I enter in http.conf to activate these functionalities? Thanks. PS could you reference a tutorial on using Safari and Web inspector
1
0
65
May ’25
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
644
Jan ’25
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
425
Dec ’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
754
Dec ’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
616
Nov ’24
simple? filename sort
given [URL.lastPathComponent] how do I sort as Finder sorts in macOS? Example: urlPaths = contentsOfDirectory(at: ... e.g., ["1H", "10Ne", "11Na"] urlPaths.sort(by: { $0 < $1 } //Apple Swift version 5.9 print(urlPaths) // 10Ne 11Na 1H whereas Finder filename sort gives // 1H 10Ne 11 Na and is beautiful. I have always taken this sort for granted and am now buggered to duplicate it.
2
0
542
Feb ’24
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
557
Feb ’24
JSONEncoder has changed
Prior to Sonoma 14.0 and Xcode 15.0.1 my custom class was encoded in a consistent pattern that I exploited to append the file many thousands of times. Now, the encodings are of a seemingly random pattern that cannot be exploited to append. This may be a result of efforts to make the encoding more efficient or virtually any other reason. My questions are: how do I revert to the previous JSONEncoder while using current OS & Xcode versions?, i.e, what files and in what locations do I restore? is it likely to be sustainable if I did so? It has been previously noted that atomic files are not "append able" which is why I used JSON in the first place. Any info or suggestion is appreciated. Thank you.
2
1
785
Nov ’23
memory race on deep looper
Below is some simple code that does nothing, saves nothing. Yet the memory usage keeps rising. Am I missing something or is this a bug? The code requires 6 core CPU minimum. ContentView.swift import SwiftUI import Combine struct ContentView: View { @EnvironmentObject var loopClass:LoopClass var body: some View { ProgressView(value: Float(loopClass.loop_count), total: Float(loopClass.max_loops) ).progressViewStyle(.circular).padding() Button("Run looper", action: { loopClass.loopFunc() } ) } } LoopClass.swift import Combine class LoopClass: ObservableObject { @Published var loop_count = 0 @Published var max_loops = 0 func loopFunc () { let loopSet = [ 1, 3, 5, 7, 11, 13 ] max_loops = Int(pow(Double(loopSet.count), 13.0)) print("max_loops = \(max_loops)") for loop13 in loopSet { DispatchQueue.global().async { for loop12 in loopSet { for loop11 in loopSet { for loop10 in loopSet { for loop9 in loopSet { for loop8 in loopSet { for loop17 in loopSet { for loop16 in loopSet { for loop5 in loopSet { for loop4 in loopSet { for loop3 in loopSet { for loop2 in loopSet { for loop1 in loopSet { DispatchQueue.main.async{ self.loop_count += 1 } } }}}}}}}}}}} } // DQ } // for loop13 } }
2
0
916
Jul ’23
12 core M2 mini only using 4 cores, Intel Mac mini used 6
Developing a program that needs maximum cores. My previous Intel Mac mini used all 6 cores, according to Activity Monitor. It showed 600% cpu usage. I assumed the M2 would use twelve, but only shows 400% cpu usage in Activity Monitor, ergo, two less! I don't recall setting a core usage parameter in Xcode. Any ideas? Ventura 13.3 and Xcode 14.3 up to date as of this post.
2
0
902
May ’23
Using LAPACK in macOS 13.3
My app complied when “Minimum Deployments” was 12.x but with 13.3 I get the alert: " 'dsyev_' was deprecated in macOS 13.3: The CLAPACK interface is deprecated. Please compile with -DACCELERATE_NEW_LAPACK to access the new lapack headers." Where do I enter this compiler flag? I am using XCode 14.3 Ventura 13.3.1 on an Intel macMini Build Phases:Link Binary With Libraries (3 items) libf77lapack.tbd libclapack.tbd liblapack.tbd each of which is provided by Apple. I have rooted around in “Build Settings”, “ Build Phases”, and “Build Rules” but can’t see where to put the compiler flag. Thanks
5
1
2.0k
May ’23