Post

Replies

Boosts

Views

Activity

Recovering Lost Password
The MacStudio has only one account on it, and that is of course an admin account. The password to this account is lost. The MacStudio has an association with my AppleID I log into developer.apple.com with. To recover, this procedure was followed: The recovery mode was entered by holding down the power key for 15 seconds. In the options that appeared the "Forgot all passwords" option was clicked on. I entered the same credentials I log into developer.apple.com with. The credentials were accepted. The shell was launched, and the in the shell the command "resetpasswords" entered. The message: "If you don't know the password for any user on your Mac, you can deactivate your Mac and set new passwords for all users. An internet connection will be required to reactivate your Mac". Beneath this message there was in blue text: "Deactivate Mac". I did not proceed after this because I was not sure what deactivation would mean for the files on the computer. On it there is code written in Swift that needs to be preserved. If the deactivation is done will the files be preserved, and be accessible? Or does a deactivation remove all files?
1
1
255
Feb ’25
Creating a missing Info.plist file
The Info.plist file is missing from my project as shown in this screenshot: Yet the project has properties as the screenshot does show. So obviously the properties are being remembered somewhere, and I do not know where. As can be seen no paths to an Info.plist is currently set. I need to create a new Info.plist file, and add it to the project. My concern now is about synchronization. If I were to do this by navigating to: File => New => File => Resource => Property List, and named it Info.plist, will this new property list file automatically synchronized with all of my current settings? Or would it contain only default settings, and synchronize my project's settings with those default settings? I suspect the original Info.plist file was lost when I decided rename folders, and filenames, and had to copy everything into a new project to do that. I failed to copy over the Info.plist file.
1
0
6.8k
May ’23
case keyword used without switch
In TicTacToe example there is in the override method "PasscodeViewController.viewDidLoad()" this snippet of code: if let browseResult = browseResult, case let NWEndpoint.service(name: name, type: _, domain: _, interface: _) = browseResult.endpoint { title = "Join \(name)" } What confuses me: The use of the "case" keyword without a switch statement. The "case" keyword does not have a constant to compare with to decide if will branch here. And what of the method call to NWEndpoint.service() being set equal to something? Is this actually defining what the service method will do when the system calls it?
9
0
1.2k
Jun ’23
Every added View Controller adds a Launch Screen
I am still very new to Swift. Now I am learning about storyboards. I added two View Controllers to the app by using the + icon in Xcode's Title Bar. Added one button to each of their screens, and then added a connectors (segues) between them, so that each button would navigate to the other screen. As soon as these connectors are added, each segue gets the error: /Users/ ... /LaunchScreen.storyboard Launch screens may not have triggered segues. So I figured at first that the first screen I added to the project by means of adding a View Controller must have been launch screen. So I remove the segues, I add two more screens in the same way, and make the same connections between these two new screens. The same errors appeared. It appears to me that Xcode considers every new screen added by dragging in a View Controller is a launch screen. How do I make only the first screen the "Launch Screen"?
1
0
1k
Jun ’23
Accessing Interface Builder GUI Controls Anywhere in the App
I used the Interface Builder to place a Switch object in a view. I ctrl dragged it into the Assistant to make its handler a method of the class the view's is in, which is itself a subclass of "UITableViewController". A dialog box appear into which I entered the function name, and select the the option to have the sender as an argument. The result is function of the form: @IBAction func switchStateChange(_ sender: UISwitch) { } Now I need to query this Switch's On/Off state from elsewhere in the program, and if necessary change its state. It is not a good solution to save the sender parameter to a global variable because then it would require the user to change this switch's state before that global variable is set. What is needed is to identify, and lookup, this switch object to access it from anywhere in the application. How is this done?
1
0
744
Jun ’23
Can @AppStorage be used on Storyboard objects?
The need is to persist between launches the state of storyboard objects such as of type UISwitch, UITextField, etc. Can this be done using @AppStorage? If so how can @AppStorage be set to watch these? I tried getting @AppStorage to watch an outlet class member variable that is connected to the storyboard object: @IBOutlet weak var iPhoneName: UITextField! @AppStorage("iPhoneName") var iPhoneName: String = "" This got an error because the variable to be watched is already declared. I decided to make the the watched variable different than the one connected to the Storyboard's UITextField object: @AppStorage("iPhoneName") var striPhoneName: String = "" and got the error: Unknown attribute 'AppStorage' . In what import library is @AppStorage defined? If @AppStorage cannot be used for this, what is the easiest way to code storyboard object persistence? I am looking for an easy, and quick way. I am not concerned with memory usage right now.
2
0
1.8k
Jan ’24
Can't Create Storyboard Outlet
I am not able drag a reference object from a Storyboard screen to code in the Assistant. The expected blue line appears as the screenshot shows, but no code is created in the Assistant. This reference object is not in the Launch Screen. When the the screen this object is in is highlighted, the correct file opens in the Assistant. Dragging this object from the "Content View" folder also does not work, even though the blue line also appears. I was recently able to do this. Something changed. What might have changed?
1
0
1k
Jul ’23
Using DispatchQueue
I am attempting to follow this example of how to create a camera app: https://www.appcoda.com/avfoundation-swift-guide/ It describes a sequence of 4 steps, and these steps are embodied in four functions: func prepare(completionHandler: @escaping (Error?) -> Void) { func createCaptureSession() { } func configureCaptureDevices() throws { } func configureDeviceInputs() throws { } func configurePhotoOutput() throws { } DispatchQueue(label: "prepare").async { do { createCaptureSession() try configureCaptureDevices() try configureDeviceInputs() try configurePhotoOutput() } catch { DispatchQueue.main.async { completionHandler(error) } return } DispatchQueue.main.async { completionHandler(nil) } } } What is confusing me is that it appears these four steps need to be executed sequentially, but in the Dispatch Queue they are executed simultaneously because .async is used. For example farther down that webpage the functions createCaptureSession(), and configureCaptureDevices(), and the others, are defined. In createCaptureSession() the member variables self.frontCamera, and self.rearCamera, are given values which are used in configureCaptureDevices(). So configureCaptureDevices() depends on createCaptureSession() having been already executed, something that it appears cannot be depended upon if both functions are executing simultaneously in separate threads. What then is the benefit of using DispatchQueue()? How is it assured the above example dependencies are met? What is the label parameter of the DispatchQueue()'s initializer used for?
1
0
858
Jul ’23
How to add a scene, and its class, to the Storyboard
I added a scene to an existing story board that already has other scenes. I put focus on the new scene, and in the Identity Inspector's "Class" field I gave it a class name. The "Storyboard ID" field did not show in this inspector. Why would it not? No file named after the class name I gave it appeared in the "Project navigator". Is this supposed to happen automatically? Or must I create this Swift file that contains the class definition for the scene manually?
2
0
1.7k
Jul ’23
"Editing Did End" event is not calling its event handler
I have a UITextField object on a storyboard's scene. Its "Editing Did End" event is connected to the view controller's "actIPhoneName()" event handler method as shown in this screenshot. I configured the keyboard to show its "Done" key. I expected that when this Done button is touched, that the keyboard would disappear, and the actIPhoneName() method would be called. But neither of these happen, nor does anything else. The UITextField object remains in edit mode. The breakpoint is never reached. What must I do to make the Done keyboard key work to make the UITextField object lose its First Responder status, and call its "Editing Did End" event handler method?
1
0
846
Jul ’23
How to make the return key appear on numeric keyboards?
I have a UITextField object in a storyboard's scene where the user is make numeric entries. Because this field is for numbers only I set the keyboard type to "Number Pad" in attributes. But this keyboard does not have a return key which leaves the user unable to signal when the entry is complete, the keyboard should be put away, and the entered value processed. I tried all the other numeric keyboards also, and found that none of them has a return key. The default keyboard does, but it is a full alphanumeric keyboard which is undesirable for that field. How can I cause the return key, done key, or whichever does that function, appear on a numeric only keyboard?
2
0
2.8k
Jul ’23
PHAssetChangeRequest.creationRequestForAsset() Crashes
There is a crash on the closing brace of the photo capture completion handler where commented below. // Initiate image capture: cameraController.captureImage(){ ( image: UIImage?, error: Error? ) in // This closure is the completion handler, it is called when // the picture taking is completed. print( "camera completion handler called." ) guard let image = image else { print(error ?? "Image capture error") return } try? PHPhotoLibrary.shared().performChangesAndWait { PHAssetChangeRequest.creationRequestForAsset(from: image) } // crash here } When step through pauses on that closing brace, and the next step is taken, there is a crash. Once crashed what I see next is assembly code as shown in the below disassembly: libsystem_kernel.dylib`: 0x1e7d4a39c <+0>: mov x16, #0x209 0x1e7d4a3a0 <+4>: svc #0x80 -> 0x1e7d4a3a4 <+8>: b.lo 0x1e7d4a3c4 ; <+40> Thread 11: signal SIGABRT 0x1e7d4a3a8 <+12>: pacibsp 0x1e7d4a3ac <+16>: stp x29, x30, [sp, #-0x10]! 0x1e7d4a3b0 <+20>: mov x29, sp 0x1e7d4a3b4 <+24>: bl 0x1e7d3d984 ; cerror_nocancel 0x1e7d4a3b8 <+28>: mov sp, x29 0x1e7d4a3bc <+32>: ldp x29, x30, [sp], #0x10 0x1e7d4a3c0 <+36>: retab 0x1e7d4a3c4 <+40>: ret Obviously I have screwed up picture taking somewhere. I would much appreciate suggestions on what diagnostics will lead to the resolution of this problem. I can make the entire picture taking code available on request as an attachment. It is too lengthy to post here.
1
0
867
Jul ’23
How to look up Photo Pixel Formate Types?
I listed the AVCapturePhotoSettings.availablePhotoPixelFormatTypes array in my iPhone 14 during a running photo session and I got these type numbers: 875704422 875704438 1111970369 I have no idea what these numbers mean. How can I use these numbers to look up a human readable string that can tell me what these types are in a way I am familiar with, such as jpeg, tiff, png, bmp, dng, etc, so I know which of these numbers to choose when I instantiate the class: AVCaptureSession?
1
0
1.7k
Jul ’23