Post

Replies

Boosts

Views

Activity

Reply to Why am I getting this error all over the project? Can anyone help solve it?
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.
Jan ’24
Reply to SwiftUi view responding to model changes
The reason the view doesn't respond to data changes when you switch to @State is that CheckItem is a class. The @State property wrapper works with structs, not classes. There are two ways to fix this. The first way is to make CheckItem a struct and remove @Published from any of the properties in CheckItem where you added them. By making CheckItem a struct, you can use @State and @Binding. The second way is to use @StateObject in the containing view and @ObservedObject in any other views where you want to use the CheckItem object. @StateObject is the class equivalent of @State, and @ObservedObject is the class equivalent of @Binding.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’24
Reply to Beginner error
You have two statements on one line without a semicolon separating them. You can't do that in Swift. var highscore = 0 highscore = 99 Place the statements on separate lines. var highscore = 0 highscore = 99 You could also simplify things by setting the value to 99 at the start. var highscore = 99 I don't know if that's enough to fix the build error. You didn't show much code. I recommend Hacking with Swift's 100 Days of SwiftUI free course to learn iOS development. They also have a forum where you can ask questions if you run into problems when going through the course. Their forum is more beginner friendly than this forum. https://www.hackingwithswift.com/100/swiftui
Topic: App & System Services SubTopic: Core OS Tags:
Jan ’24
Reply to XCode swift assistant editor
Im doing exactly what you said You did the first part of what I said, opening the assistant editor. That didn't work, as you get the header file for Apple's UIViewController class instead of the source code for your view controller. You didn't do the second part of what I said, opening a new editor view. Open a new editor view by clicking the rightmost button in the upper right corner of your screenshot, the button with a + sign in it. That will open a second view of the storyboard in Xcode. Above the storyboard in your screenshot is a jump bar that lets you jump to any file in your project. If you click the leftmost item in the jump bar, you will open a menu that will let you navigate through the files in your project. Go through the menus until you find your view controller file and choose that file, and you will be able to see the storyboard and source code side by side.
Jan ’24
Reply to XCode swift assistant editor
What is the course you are following? Above the source code editor on the right side are a set of buttons with small icons. Clicking the button with the stack of horizontal lines lets you open the assistant editor. Choose Assistant to open the assistant editor. If that doesn't do what you need, clicking the button with the + sign in the screenshot (the right button in the group of three at the top left of the screenshot) opens another editor view. That should let you see both the storyboard and the source code file at the same time. If that doesn't work, you are going to have provide more details on what you are trying to do.
Jan ’24
Reply to any example based on SpriteKit for getting started ?
There are two books that I would recommend to learn SpriteKit, one paid and one free. The paid one is Apple Game Frameworks and Technologies. https://pragprog.com/titles/tcswift/apple-game-frameworks-and-technologies/ The free one is 2D Apple Games by Tutorials. It covers SpriteKit. You may also have to deal with changes in Xcode since the book was published. You can download the book from Kodeco's deprecated book repository. https://github.com/kodecocodes/deprecated-books The site Check Sim Games has introductory SpriteKit articles. https://www.checksimgames.com/
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Jan ’24
Reply to Xcode build/Developer Account
Choose Product > Archive in Xcode to archive your project. Open the Organizer by choosing Window > Organizer. Select your archived project from the list on the left side of the Organizer. Click the Distribute App button. Choose Copy App from the list of options. Click the Next button. Pick a location to save the app. Click the Export button. Optionally you can copy the exported app to your Applications folder. The following article has more details: https://www.swiftdevjournal.com/running-a-mac-app-outside-of-xcode/
Jan ’24
Reply to Why am I getting this error all over the project? Can anyone help solve it?
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.
Replies
Boosts
Views
Activity
Jan ’24
Reply to SwiftUi view responding to model changes
The reason the view doesn't respond to data changes when you switch to @State is that CheckItem is a class. The @State property wrapper works with structs, not classes. There are two ways to fix this. The first way is to make CheckItem a struct and remove @Published from any of the properties in CheckItem where you added them. By making CheckItem a struct, you can use @State and @Binding. The second way is to use @StateObject in the containing view and @ObservedObject in any other views where you want to use the CheckItem object. @StateObject is the class equivalent of @State, and @ObservedObject is the class equivalent of @Binding.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Beginner error
You have two statements on one line without a semicolon separating them. You can't do that in Swift. var highscore = 0 highscore = 99 Place the statements on separate lines. var highscore = 0 highscore = 99 You could also simplify things by setting the value to 99 at the start. var highscore = 99 I don't know if that's enough to fix the build error. You didn't show much code. I recommend Hacking with Swift's 100 Days of SwiftUI free course to learn iOS development. They also have a forum where you can ask questions if you run into problems when going through the course. Their forum is more beginner friendly than this forum. https://www.hackingwithswift.com/100/swiftui
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Using UIKit & Storyboards
App playgrounds require you to use SwiftUI. You have to create an Xcode app project to use UIKit and storyboards.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Problem with iOS in Xcode
Once a few weeks Xcode want me to install iOS platform again, is it normal? No, it is not normal. I have not encountered this problem so I don't have a solution for you.
Replies
Boosts
Views
Activity
Jan ’24
Reply to XCode swift assistant editor
Im doing exactly what you said You did the first part of what I said, opening the assistant editor. That didn't work, as you get the header file for Apple's UIViewController class instead of the source code for your view controller. You didn't do the second part of what I said, opening a new editor view. Open a new editor view by clicking the rightmost button in the upper right corner of your screenshot, the button with a + sign in it. That will open a second view of the storyboard in Xcode. Above the storyboard in your screenshot is a jump bar that lets you jump to any file in your project. If you click the leftmost item in the jump bar, you will open a menu that will let you navigate through the files in your project. Go through the menus until you find your view controller file and choose that file, and you will be able to see the storyboard and source code side by side.
Replies
Boosts
Views
Activity
Jan ’24
Reply to Xcode 5.0.1 can't run on macOS Catalina
What versions did you try to install? According to the site Xcode Releases, Xcode 12.1 is the latest version that runs on Catalina. https://xcodereleases.com Xcode 11 and 12 are the only Xcode versions that officially support Catalina.
Replies
Boosts
Views
Activity
Jan ’24
Reply to XCode swift assistant editor
What is the course you are following? Above the source code editor on the right side are a set of buttons with small icons. Clicking the button with the stack of horizontal lines lets you open the assistant editor. Choose Assistant to open the assistant editor. If that doesn't do what you need, clicking the button with the + sign in the screenshot (the right button in the group of three at the top left of the screenshot) opens another editor view. That should let you see both the storyboard and the source code file at the same time. If that doesn't work, you are going to have provide more details on what you are trying to do.
Replies
Boosts
Views
Activity
Jan ’24
Reply to Are changes to published embedded objects really not detected in SwiftUI?
The view that owns the ObservableObject must use the @StateObject property. struct StartupView: View { @StateObject var userMgr: UserManager ... } Use @ObservedObject in any other views that need access to the user manager.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to What version of Xcode can I make a game for older iOS versions (ex: iOS 5) but still playable on iOS 17?
iOS 13 is the earliest iOS version that can run a SwiftUI app. Xcode 14 is currently the earliest Xcode version you can use to submit apps to the App Store. iOS 11 is the earliest version you can target with Xcode 14.
Replies
Boosts
Views
Activity
Jan ’24
Reply to Removing source control repository from specific Xcode project
There is a hidden folder named .gitin your project folder that contains the git repository. Move that folder to the trash to remove the repository for the project. Press Cmd-Shift-Dot in the Finder to show hidden files and folders so you can remove the .git folder inside the project folder.
Replies
Boosts
Views
Activity
Jan ’24
Reply to any example based on SpriteKit for getting started ?
There are two books that I would recommend to learn SpriteKit, one paid and one free. The paid one is Apple Game Frameworks and Technologies. https://pragprog.com/titles/tcswift/apple-game-frameworks-and-technologies/ The free one is 2D Apple Games by Tutorials. It covers SpriteKit. You may also have to deal with changes in Xcode since the book was published. You can download the book from Kodeco's deprecated book repository. https://github.com/kodecocodes/deprecated-books The site Check Sim Games has introductory SpriteKit articles. https://www.checksimgames.com/
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to Xcode build/Developer Account
Choose Product > Archive in Xcode to archive your project. Open the Organizer by choosing Window > Organizer. Select your archived project from the list on the left side of the Organizer. Click the Distribute App button. Choose Copy App from the list of options. Click the Next button. Pick a location to save the app. Click the Export button. Optionally you can copy the exported app to your Applications folder. The following article has more details: https://www.swiftdevjournal.com/running-a-mac-app-outside-of-xcode/
Replies
Boosts
Views
Activity
Jan ’24
Reply to Implementing Renaming and Reordering in SwiftUI Sidebar for macOS App
This could be a SwiftUI bug on Mac. I recommend filing a bug report. Choose Help > Report an Issue in Xcode to file a bug report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’24
Reply to How do you make lines of code only for a specific destination in Xcode?
Use the #if os statement to run code for a specific platform. #if os(iOS) // Run iOS code here #endif You can also place the code that Vision Pro does not support into its own file and tell Xcode to compile that file only for the iOS destination. More details are in the following article: https://www.swiftdevjournal.com/xcode-multiplatform-app-targets/
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’24