Post

Replies

Boosts

Views

Activity

Reply to Unable to pass down returned value from one view to another
What is the specific problem you are having? What are you expecting to happen when you tap the Add button and what happens when you tap the Add button? I looked at your code for the navigation bar items. The navigation link for the Add button passes an empty note to the note view with an empty ID before you have a chance to call addNote and get the new note's ID. You may have to create a new view for adding notes and show that when someone taps the Add button. Add the note when someone taps an Add button in the Add Note view. Your DataManager class refers to a Note struct or class. Why do you have separate @State properties for the note contents and ID in the NoteView struct instead of a Note instance? Your addNote function could return the note instead of the ID. I think it would be easier to deal with notes than to deal with their individual pieces separately.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Could not load NIB in bundle
Are you getting this error when running your app in Xcode? If so, you're getting the error because you're running a newer version of tvOS than Xcode 13.1 supports. Xcode 13.1 does not support any versions of tvOS newer than 15.2. You have two options: update Xcode to Xcode 13.3 or 13.4 or downgrade to tvOS 15.2. I'm not sure if it's possible to downgrade to an older version of tvOS. If you are still getting the error after updating Xcode, you will have to show your code to load the storyboard from the app bundle and show the layout of your app bundle for anyone to help you. Are you sure the storyboard is in the app bundle? Is the storyboard in the app bundle location where the storyboard loading code is expecting it?
Topic: App & System Services SubTopic: Core OS Tags:
May ’22
Reply to About page
Is this for iOS or Mac? For Mac I can answer. In Xcode choose File > New > File and add a RTF file to your project. Name the file Credits.rtf. Edit the files with what you want to appear in the About box. You can find additional information in the following article: https://www.swiftdevjournal.com/customizing-the-about-box-in-your-mac-app/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to Do I have to be a paid developer to develop MacOS programs for personal use?
You do not need a paid developer account to develop Mac apps for personal use. You need a paid account to do the following: Submit an app to the Mac App Store Use Apple capabilities like iCloud and Game Center Sign and notarize your app with a developer ID to work with Apple's Gatekeeper feature Gatekeeper makes it painful to open apps that aren't notarized. Without a paid developer account you won't be able to notarize your apps. Your options are to rebuild the apps periodically or bypass Gatekeeper. The following article shows how to bypass Gatekeeper for a single app: https://disable-gatekeeper.github.io
Topic: Code Signing SubTopic: General Tags:
May ’22
Reply to SwiftUI NSOpenPanel runs but then crashes Mac app
The fileOpenDialog function returns an array of optional URLs. What does that function return when you call it? The following line is going to crash if the array is empty: var csvURLString = fileOpenDialog()[0]?.path SwiftUI has a fileImporter modifier that shows an Open panel so you can avoid using NSOpenPanel. Searching for swiftui fileimporter in a search engine brings up several articles on using the file importer. If you still want to use NSOpenPanel with SwiftUI, the following article may help you: https://serialcoder.dev/text-tutorials/macos-tutorials/save-and-open-panels-in-swiftui-based-macos-apps/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to Can't run Swift App on Mojave
What architectures did you build for? What is the value of the Build Active Architecture setting? Judging by the problems you're having, it looks like you built for the active architecture only. If you click the Run button in Xcode's toolbar, Xcode is set to build a Debug build, which builds only for the active architecture. On an M1 Mac, building for the active architecture builds an app that won't run on Intel Macs. Any Mac running 10.14 isn't going to be able to run an M1 app. If you want your app to run on both M1 and Intel Macs, take the following steps: Choose Product > Archive to build and archive this project. This will create a universal binary that runs on both M1 and Intel Macs. Open the Organizer by choosing Window > Organizer. Select your archive from the list in the Organizer. Click the Distribute App button on the right side of the Organizer. Choose Copy App as the method of distribution. Click the Next button. Choose a location to store the exported app. Click the Export button. Now you should be able to copy the app to the older Mac and run it. You might have to bypass macOS's Gatekeeper security to launch the app because of choosing Copy App instead of Developer ID as the method of distribution. If the app still doesn't run on the older Mac, make sure you set the deployment target for both the project and the app target. If that doesn't work, I have nothing else to suggest.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’22
Reply to Can't run Swift App on Mojave
What type of Xcode project did you create? Xcode defaults to using SwiftUI for Mac App and Document App projects. SwiftUI projects will not run on macOS 10.14. When you choose App or Document App on a Mac project and click the Next button, make sure you choose either Storyboard or Xib from the Interface menu. Choosing Storyboard or Xib will create an AppKit project. With an AppKit project you can set the deployment target to macOS 10.14 and have the app run on macOS 10.14.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’22
Reply to Failed to prepare device for deployment
Is this error occurring because I am using Xcode 13.1 with iOS 15.4.1 and need to upgrage to Xcode 13.3 instead? Yes. The following article provides more details and workarounds if you're unable to update to Xcode 13.3: https://www.swiftdevjournal.com/dealing-with-failed-to-prepare-device-for-development-error-message-in-xcode/
Apr ’22