Post

Replies

Boosts

Views

Activity

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.
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
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/
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 Xcode build/Developer Account
When I called apple they said Id have to pay for a developer account if I wanted the software to work beyond a pre-determined testing period. Is this true? Only for iOS. You don't need a paid developer account to make Mac apps for personal use. Based on the information you supplied, the most likely cause of your build errors is the Xcode project is set to use the original developer's signing certificate. You are not the original developer so you don't have access to the certificate. I recommend setting the development team for the project to None. That will tell Xcode to not use the original developer's signing certificate when building the project. Take the following steps to do this: Open the project editor by selecting the project from the left side of the project window. Select the app target from the list of targets on the left side of the project editor. Click the Signing & Capabilities button at the top of the project editor. Choose None from the Team menu in the Signing section. That should fix the first error. Build the project again. If the second error still appears, take the following steps to add your Apple account to Xcode: Choose Xcode > Preferences to open Xcode's preferences window. Click the Accounts button at the top of the preferences window. Click the Add (+) button at the bottom of the list of accounts. Select Apple ID from the list of account types. Click the Continue button. Enter the email of your Apple ID. Click the Next button. Enter the password for your Apple ID. Click the Next button. A sheet will open with the title Apple ID Security. Click the Continue button to set up two factor authentication for signing in with this account. If that does not fix the build error, you are going to provide more information for anyone to be able to help you. Provide a link to the GitHub project you are trying to build. List the steps you took to clone and build the project.
Jan ’24