Big Sur corrupted Disk Utility?
Just touching the File menu requires futile (endless) authorization.
Anyone else have this issue?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
The model increments through a range of dates converted to Double and scaled, ranging from 0 to 1.0
I wish to show a determinate progress bar.
As I understand it, the ProgressView() must be declared in the ContentView and its progress var must be declared as a @State var
The ContentView declares the model vars as @EnvironmentObjects
If I declare:
@State private var = model.progressValue
I get the error:"Cannot use instance member 'model' within property initializer; property initializers run before 'self' is available"
btw the model class declares:
@Published var progressValue : Double
The model func (to increment through dates) is launched by a button in the ContentView.
idk how to get the incremented progressValue from the model to the ContentView State var.
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?
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.
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?
I am porting a functioning Swift App to SwiftUI with the ambitious intention of Multiple platform coding, so the project was created as such.
I've worked out every issue except as the title suggests.
My pertinent code:
import SwiftUI
import SceneKit
struct ContentView: View {
var scene : SCNScene = SCNScene = { () -> SCNScene in // DO NOT REPLACE OR MODIFY THE FIRST AND LAST LINES OF THIS VAR DECLARATION, e.g., "var scene:SCNScene{ ... }" else initScene(newScene) FAILS to create children!
let newScene = SCNScene()
initScene(newScene) // adds ChildNodes named: "precession" & "nuclearSpin"
let newCamera = SCNNode()
newCamera.position = SCNVector3(x: 0, y: 0 ,z: 40)
newCamera.name = "cameraNode"
newCamera.camera = SCNCamera()
newScene.rootNode.addChildNode(newCamera)
10. newScene.fogDensityExponent = 0.0 return newScene
}()
@EnvironmentObject var structures:Structures
@State private var Ncv = Int()
@State private var indexMomentcv = Int()
var body: some View {
ZStack{
20. SceneView(
21. scene: scene,
22. pointOfView: scene.rootNode.childNode(withName: "cameraNode", recursively: false),
23. options: [.allowsCameraControl, .autoenablesDefaultLighting, .temporalAntialiasingEnabled]
24. ).colorInvert()
25. VStack(alignment: .trailing){
26. Group{
27. HStack{
28. VStack{ // ... and so on
29.
I have verified the existence of all nodes created for the scene, i.e., the objects to be seen, using these useful functions:
func printChildNodeHierarchy(node: SCNNode) { node.enumerateChildNodes( { (anyNode,false) -> Void in return print( anyNode ) } ) } // SUPER handy
func printChildNodeTransform(node: SCNNode) { node.enumerateChildNodes( { (anyNode,false) -> Void in return print( anyNode.name!,"\t", anyNode.simdTransform,"\t",anyNode.scale ) } ) }
func printChildNodeAction (node: SCNNode) { node.enumerateChildNodes( { (anyNode,false) -> Void in return print( anyNode.name!,"\t", anyNode.hasActions,"\t",anyNode.actionKeys ) } ) }
...which print in the debugging area. I have verified the materials assignments to the elements of those nodes. So, everything is in place as in the functioning Swift/macOS App but I just don't see the objects.
What I've tried:
Since I run in DarkMode theme I have cycled through the combinations of Dark/Light and with/without line 24's .colorInvert() and swapping ZStack with HStack.
Some combo's do wash-out, but still no objects.
I zero'd out the fog thinking it might be too foggy. Not.
I've created a scene.scn file as a resource, applied the above attributes to it, reference it with scene = SCNScene(named: scene.scn"), but get the same non-result.
Idk if some checkbox is errant in the build/target etc. area. Wouldn't know if it was. I'm not a professional programmer.
Any thoughts are appreciated. I've been stuck for days.
oh yeah: as of this posting I am up to date on all Apple software, running 2018 MacMini/Intel/SSD
As stated in the title, I want to hide or show a StackView when a menu item is selected, which in turn changes a global variable.
How do I access the identity or handle of the StackView?
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...
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.
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
}
}
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.
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.
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
			
My ContentView has an @EnvironmentObject and a few @State var's.
The State vars are for use in TextFields, one can use a Picker or manual entry, and works fine.
The other State var is to have its value set when the user hits a Button whose action executes a host of functions that changes the values of over twenty @Published vars monitored/updated by the @EnvironmentObject vis-a-vis Combine. This TexField must also be manually set/edited when desired. Within that same Button(action:{}) the next line of code attempts to set a State var to the value of the Published EnvironmentObject that had been changed by all those functions in the previous line.
The problem is: the EnvironmentObject is not updated by the time this line of code is executed. Such that the Button must be pressed twice for the result to change the TextField.
I have scoured the web and did not find, or did not understand, what is amiss.
I have successfully used .id(UUID()) on Views to ensure updates, but this issue is within a Button/action and I wouldn't know how to implement it here as TextField is a struct, and I can't implement a View.id(UUID()) inside the Button. So far as I know.
Thanks.
My iNet works fine but Numbers.app, Pages.app etc. not downloading.