Starting April 29 Apple is going to require Xcode 15 for App Store submissions. Xcode 15 requires macOS 13+.
https://developer.apple.com/news/?id=fxu2qp7b
The chances are high you won't be able to submit apps with that MacBook Air.
I recommend buying a Mac with an ARM processor. ARM Macs are going to be supported longer than Intel Macs.
Post
Replies
Boosts
Views
Activity
The .fileImporter modifier isn't for opening your SwiftUI app's documents. It's for opening other types of files in your app. The document struct's init that takes a ReadConfiguration is for opening your app's documents, either from a document picker (iOS) or by choosing File > Open (Mac).
Instead of using your document struct's init that takes a ReadConfiguration, write a function to process the JSON that takes a URL as an argument. Pass the URL the file importer gives you to the JSON processing function.
I am not sure if the Swift Playgrounds app has been updated to support SwiftData, but the following article shows how to use Core Data in a Swift Playgrounds app:
https://www.cephalopod.studio/blog/build-an-app-on-ipad-with-swift-playgrounds-and-core-data
I have never had a problem with my projects when moving to a new version of Xcode.
Create backups of your projects before updating so you have a copy you can go back to if you do encounter a problem when updating to Xcode 15.
Choose Help > Report an Issue in Xcode to file feedback for this request. Posting about it on these forums isn't going to do anything.
I'm trying to follow STORMVIEWS tutorial which was made with an old version of swift were viewed load was still available
The viewDidLoad method is still available. Your problem is that you are using SwiftUI to follow a tutorial that uses UIKit.
Start over by creating a UIKit project. Take the following steps to create a UIKit project in Xcode:
In Xcode choose File > New > Project.
Select iOS from the platforms at the top of the New Project Assistant.
Select the App template from the list of iOS app templates.
Click the Next button.
Choose Storyboard from the Interface menu.
Read the following article for more details and a screenshot:
https://www.swiftdevjournal.com/xcode-11-missing-view-controllers/
Not many people on this forum use SDL. You have a better chance of solving your problem by asking on SDL's forums:
https://discourse.libsdl.org
You may also want to search GitHub for SDL Xcode project templates. Using a project template can make working with SDL in Xcode easier.
If the solutions in the following article don't work:
https://www.swiftdevjournal.com/dealing-with-failed-to-prepare-device-for-development-error-message-in-xcode/
You won't be able to run and debug the project on your iPhone running iOS 17.3.
You have the following options:
Buy a new Mac.
Use Open Core Legacy Patcher to update your current Mac to the latest version of macOS so you can use Xcode 15.
Use an iOS device running iOS 16 or earlier to run your project.
The most likely cause of your problem is you are trying to place and run multiple small programs in one Xcode project. Each program has its own main function, but a C program can have only one main function. If you add three files to your project, intending each file to be its own program, and try to run the project, Xcode doesn't know you want to run only one of the files. It assumes you want to run all the files, sees you have three main functions, and generates a link error.
Xcode is designed to have one program per project, no matter how small the program is. If you are learning C and writing multiple small programs, you have the following options:
Create one Xcode project for each program.
Create one Xcode project and add a target for each program. Use the jump bar in the Xcode toolbar above the code editor to choose the target to run.
Create one Xcode project and use the target membership checkboxes on the right side of the project window to tell Xcode which files/programs you want to build and run.
Use a text editor like VS Code, TextMate, or BBEdit to write your code instead of Xcode. I know TextMate comes with a bundle to run your programs from inside the editor. VS Code probably has an extension that allows this as well.
Your first example uses SwiftUI. Every SwiftUI view requires a body.
var body: some View {
// Code inside the body removed.
}
The body property must return a SwiftUI view. The code in your body property does not have a SwiftUI view in it so you are going to get an error when you build the project.
You should move all the code you have in body into a separate function.
I also recommend going through a book or course to learn SwiftUI. The site Hacking with Swift has a free 100 day course that teaches SwiftUI.
https://www.hackingwithswift.com/100/swiftui
The most likely cause of the error is that the outlets are not connected in the storyboard.
Use the connections inspector for the storyboard to check the connections. Open your storyboard in Xcode and choose View > Inspectors > Connections to open the connections inspector.
You may find the following article helpful:
https://www.swiftdevjournal.com/fixing-the-thread-1-fatal-error-unexpectedly-found-nil-while-implicitly-unwrapping-an-optional-value-error/
I can help you with adding a product to the cart from the sheet. The CartManager has the function to add a product to the cart.
To add a product in your sheet, add a property for the cart manager to ProductDetailSheet. Because CartManager is a class, you should use the @ObservedObject property wrapper for the cart manager.
@ObservedObject var cart: CartManager
You have not shown the code for the view that opens the sheet. But in that sheet you must add a property with the @StateObject property wrapper for the cart manager.
@StateObject var cart: CartManager
Pass the cart to the sheet.
When someone taps the Add button, call the addToCart function to add the product to the cart.
Button("Add") {
cart.addToCart(product: product)
isSheetPresented = nil
}
I am not sure if this is enough to get the product adding working, but it should give you a start.
I'm 99% sure you don't need the $ character with @StateObject and @ObservedObject. If you do need it, Xcode will show an error when you build the project.
You are dividing two integers. When the computer divides two integers, it removes the remainder. That is why you get 12.0 when you divide 25 by 2 instead of 12.5.
Convert the integers to Double before doing the division to get the correct value when dividing. See the following Stack Overflow question to learn how to convert an integer to a Double:
https://stackoverflow.com/questions/27467888/convert-int-to-double-in-swift
I don't see any code in your calculate function where you do any calculations so I can't tell you where to put the code to convert to Double. Where do you perform the division?
You have a link error, but your screenshot does not show the actual error.
To find the actual error, press Cmd-9 in Xcode to open the report navigator. The report navigator will let you see all the build steps in your project. You may find the following article helpful:
https://www.swiftdevjournal.com/why-wont-my-xcode-project-build/
When you find the actual error, reply in this thread and paste the text of the error message. Without the error message no one here can give you any more help.
The usual causes of link errors are forgetting to include a framework and using the same name for a class or struct in your code that is in one of the frameworks your app links to.