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...
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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?
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.
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.
I use as many cpu's as I can get with DispatchQueue. How do I test the Mac for cpu count in my code?
My iNet works fine but Numbers.app, Pages.app etc. not downloading.
MAGMA API runs on NVIDIA or AMD GPU's via CUDA.
Are there plans to code Accelerate for Metal?
Thanks
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
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
Topic:
Graphics & Games
SubTopic:
SceneKit
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. |-(
I accidentally added my ContentView for my project into my local Developer Documentation and I cannot get rid of it.
The Edit/delete menu item is dim when my file is selected.
Topic:
Developer Tools & Services
SubTopic:
Xcode
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
I have a small .mov I created using screenshot and I want to use it as a preview. I have managed to resize it to the required 1920x1080, added a sound track using ffmpeg (home-brew), drop it into an iMovie App preview project, share it as a file, drag that file to App Store Connect/Apps/myApp/"App previews and Screenshots" only to have it rejected for "frame rate too high", 30 fps required. There appears to be no way to specify frame rate in "Screenshot" nor iMovie during "share". Aside from using a third party app "Handbrake" to edit the file, what can be done?
Maybe more importantly, why is 30 fps required when it isn't a standard output of screenshot nor iMovie/AppPreviewProject ?
btw: iMovie/AppPreview/Help shows submittal of non-1920x1080 files to AppStoreConnect
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Image I/O
Media Player
App Store Connect
Big Sur corrupted Disk Utility?
Just touching the File menu requires futile (endless) authorization.
Anyone else have this issue?
took a bit of experimenting...
import AVKit // macOS & iOS
class ViewController_myShow: NSViewController {
@IBOutlet var myMOV: AVPlayerView!
10.
override func viewDidLoad() {
super.viewDidLoad()
let playerView = AVPlayerView()
20.
21. playerView.translatesAutoresizingMaskIntoConstraints = false
22.
23. view.addSubview(playerView)
24.
25.
26.
27. playerView.leadingAnchor.constraint (equalTo: view.safeAreaLayoutGuide.leadingAnchor ).isActive = true
28.
29. playerView.trailingAnchor.constraint (equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true
30.
31. playerView.topAnchor.constraint (equalTo: view.safeAreaLayoutGuide.topAnchor ).isActive = true
32.
33. playerView.bottomAnchor.constraint (equalTo: view.safeAreaLayoutGuide.bottomAnchor ).isActive = true
34.
35.
36.
37. playerView.controlsStyle = .floating
38.
39. playerView.showsFrameSteppingButtons = true
40.
41. playerView.showsFullScreenToggleButton = true
42.
43.
44.
45. guard let path = Bundle.main.url(forResource: "myMovie", withExtension: "mov") else { return }
46.
47.
48.
49. let player = AVPlayer(url: path)
50.
51. playerView.player = player
52.
53. playerView.player?.play()
54.
55. }
56.
57. }
The StoryBoard:AttributesInspector:AVPlayerView settings don't work for me... exactly. I had to set StoryBoard:AttributesInspector:AVPlayerView:ControlsStyle:none then include lines 37-41 in my code.
The default is StoryBoard:AttributesInspector:AVPlayerView:ControlsStyle:inline which appears on screen but does nothing, i.e., no control.
Line 21 is also required to be false.
The .mov file can be File:AddFilesTo 'd or copied to Assets.xcassets
see also:
Developer Forum:
"can't get extremely simple macOS video player to work..."
https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_macos