Post

Replies

Boosts

Views

Activity

Reply to Basics for App development (macOS)
I doubt you are going to find a course that teaches you how to build Mac apps with Python using Xcode. If you all you want to do is add a GUI to an existing command-line app, take a look at the Process class. This class lets a Mac app run command-line apps as subprocesses. Create a Swift app project and use Process to run the Python app. The Process class used to be named NSTask, which may provide better search results as Process is a generic name. If you are looking for resources to learn Mac app development, take a look at the following article: https://www.swiftdevjournal.com/resources-for-learning-mac-development/
Jul ’23
Reply to Can't figure out why nothing conforms to "View"
I would start by commenting out the call to EditButton() and see if that fixes the error. If that doesn't work, comment out the code to create the "hi" toolbar item. The only other thing I see that could cause a problem is the following line of code: Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))") That string looks fishy. It looks like you're missing a parenthesis at the end of item.timeStamp. I would start with something like the following: Text("Item at \(item.timestamp)") And add the format argument to the item text after you get the basic text to appear in the list.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to Extra argument in call when adding a new line of text
A SwiftUI view is limited to 10 subviews. If you have more than 10 subviews, you will get an Extra Arguments build error. It looks like you have more than 10 Text and Image views inside your table cell view. The workaround is to place your Text and Image views in multiple groups. Group { Text("Natural Slope") Text("Paragraph 1 over here . . . . . long 300-words at least") Image("artificial") Text("Artificial Slope") Text("another paragraph in this area containing 300 words") } Group { Image("reinforced") Text("Reinforced Slope and Gabions") Text("another paragraph words words words words words") Text("Purpose") Text("this should be a single paragraph explaining the purpose of this app") } Notice how each group has fewer than 10 subviews inside them. I omitted the modifiers for the Text and Image views to keep the code block from getting too long.
Jun ’23
Reply to Issue with founding any File.swift in the scope after update to Xcode 14.3.1
The name of the class you showed is Products, not ProductManager. That is why the compiler can't find ProductManager. Does the error go away if you change the name of the class to ProductManager or if you change ProductManager to Products in the .onAppear block? You also need to create an instance of your class to call the function. .onAppear { let manager = ProductManager() manager.loadProduct() } In a real SwiftUI app you would add a property to the view. @StateObject manager = ProductManager() My examples assume you changed the name of the class from Products to ProductManager. I recommend taking a course like Hacking with Swift's 100 Days of SwiftUI to learn SwiftUI. A course like that would help you deal with problems like the one you asked about here. https://www.hackingwithswift.com/100/swiftui
Jun ’23
Reply to Issue with founding any File.swift in the scope after update to Xcode 14.3.1
If the project built with no errors previously, clean the build folder and try building again. Choose Product > Clean Build Folder in Xcode to clean the build folder. If you still get a build error, show the code for Controller. What is Controller? What is the following code supposed to do? .onAppear { Controller() } When showing code, paste it as text and put it in a code block. The code block button is the fourth button from the left in the group of formatting buttons at the bottom of the post editor. You can also use Markdown syntax for a code block by putting three backticks on the line above and below the code in the block. https://www.markdownguide.org/extended-syntax/#fenced-code-blocks Code is easier to read in a text block than in a screenshot. Plus, people can copy and paste the text from a code block.
Jun ’23
Reply to Error setting up git hub
Are you trying to put your Xcode project on GitHub? Or do you have an existing project on GitHub that you want to import in Xcode? To put your Xcode project on GitHub, open the source control navigator in Xcode by pressing Cmd-2 and create a remote branch. To work on a GitHub project in Xcode, clone the project by choosing Source Control > Clone in Xcode. Is there an article on how to setup github with xcode? The following article may help: https://www.swiftdevjournal.com/putting-your-xcode-project-on-github-bitbucket-or-gitlab/
Jun ’23
Reply to Apple Mac install XCODE getting error when trying to install update - won't run without it
What version of Xcode is installed on your Mac? Gone to open, wants to install update. But errors when tries so can no longer use. What specifically happens when you try to launch Xcode and it asks to install and update? List each step you take and be specific. The people on this forum aren't sitting next to you in front of your Mac. They can't read your mind. They can only go by what you write here. And you didn't write enough for people to help you.
Jun ’23
Reply to Crash: Thread 2: "-[NSTaggedPointerString count]: unrecognized selector sent to instance 0xaa672ff3b4678003"
There is nothing obvious in your code that causes the crash, making this a tough error to fix. Start by adding an exception breakpoint to your project. When your app crashes Xcode will pause and show you the line of code where the crash. You can also set a breakpoint at the start of the updateLocalizedTexts function, which is the function that gets called when the app finishes launching. Then you can step through the code line by line to figure out what is causing the crash. The following article should help if you have never used Xcode's debugger before: https://www.swiftdevjournal.com/an-introduction-to-xcodes-debugger/
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to Xcode bug
Your app most likely has crashed. To see where the app is crashing, create an exception breakpoint in Xcode by choosing Debug > Breakpoints > Create Exception Breakpoint. If the app crashes Xcode will pause the app where the crash occurs. The following article may help: https://www.swiftdevjournal.com/fixing-and-avoiding-crashes-in-swift-code/
May ’23
Reply to Bug in SwiftUI List view
I can reproduce the behavior. The following Stack Overflow question has a workaround: https://stackoverflow.com/questions/56561064/swiftui-multiple-buttons-in-a-list-row You can file a bug report with Apple on this by choosing Help > Report an Issue in Xcode.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to ld: symbol(s) not found for architecture x86_64
Please list the steps in detail on what you did to create the code and compile it. The information you provided isn't enough for people to answer your question. Providing more details on what you did to create the code and compile it will give people here a chance to give you a helpful answer. You tagged your question as Xcode, but your screenshot looks like Visual Studio Code. Did you create a project in Xcode or create a C++ file in Visual Studio Code? Does you MacBook have an Intel processor or an Apple Silicon (M1 or M2 chip)? The linker error says it can't find a main function for the Intel architecture.
May ’23
Reply to SwiftUI
The usual cause of the "Closure containing a declaration cannot be used with result builder ViewBuilde" error is doing something besides showing views inside the body of a SwiftUI view. If you do something like declare a function or make a network call inside the body of a SwiftUI view, you will get this error. If you want a fix for the error, show the code for the SwiftUI view where you get this error. Without that code, no one can tell you the mistake you made that caused the error or tell you what you need to do to fix the error.
Topic: Programming Languages SubTopic: Swift Tags:
May ’23
Reply to Basics for App development (macOS)
I doubt you are going to find a course that teaches you how to build Mac apps with Python using Xcode. If you all you want to do is add a GUI to an existing command-line app, take a look at the Process class. This class lets a Mac app run command-line apps as subprocesses. Create a Swift app project and use Process to run the Python app. The Process class used to be named NSTask, which may provide better search results as Process is a generic name. If you are looking for resources to learn Mac app development, take a look at the following article: https://www.swiftdevjournal.com/resources-for-learning-mac-development/
Replies
Boosts
Views
Activity
Jul ’23
Reply to Desparate to learn Swift coding but there are no places to learn nearby
All the online courses i have found are pre recorded and use outdated version of xcode and swift. List the courses you found that you didn't like so people don't recommend those courses to you. A lot of people like the courses at Hacking with Swift. https://www.hackingwithswift.com
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Can't figure out why nothing conforms to "View"
I would start by commenting out the call to EditButton() and see if that fixes the error. If that doesn't work, comment out the code to create the "hi" toolbar item. The only other thing I see that could cause a problem is the following line of code: Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))") That string looks fishy. It looks like you're missing a parenthesis at the end of item.timeStamp. I would start with something like the following: Text("Item at \(item.timestamp)") And add the format argument to the item text after you get the basic text to appear in the list.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Extra argument in call when adding a new line of text
A SwiftUI view is limited to 10 subviews. If you have more than 10 subviews, you will get an Extra Arguments build error. It looks like you have more than 10 Text and Image views inside your table cell view. The workaround is to place your Text and Image views in multiple groups. Group { Text("Natural Slope") Text("Paragraph 1 over here . . . . . long 300-words at least") Image("artificial") Text("Artificial Slope") Text("another paragraph in this area containing 300 words") } Group { Image("reinforced") Text("Reinforced Slope and Gabions") Text("another paragraph words words words words words") Text("Purpose") Text("this should be a single paragraph explaining the purpose of this app") } Notice how each group has fewer than 10 subviews inside them. I omitted the modifiers for the Text and Image views to keep the code block from getting too long.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Can @AppStorage be used on Storyboard objects?
@AppStorage is part of SwiftUI so you can't use it if you are using UIKit and storyboards for your user interface. The UserDefaults class is the UIKit equivalent of @AppStorage.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Issue with founding any File.swift in the scope after update to Xcode 14.3.1
The name of the class you showed is Products, not ProductManager. That is why the compiler can't find ProductManager. Does the error go away if you change the name of the class to ProductManager or if you change ProductManager to Products in the .onAppear block? You also need to create an instance of your class to call the function. .onAppear { let manager = ProductManager() manager.loadProduct() } In a real SwiftUI app you would add a property to the view. @StateObject manager = ProductManager() My examples assume you changed the name of the class from Products to ProductManager. I recommend taking a course like Hacking with Swift's 100 Days of SwiftUI to learn SwiftUI. A course like that would help you deal with problems like the one you asked about here. https://www.hackingwithswift.com/100/swiftui
Replies
Boosts
Views
Activity
Jun ’23
Reply to Issue with founding any File.swift in the scope after update to Xcode 14.3.1
If the project built with no errors previously, clean the build folder and try building again. Choose Product > Clean Build Folder in Xcode to clean the build folder. If you still get a build error, show the code for Controller. What is Controller? What is the following code supposed to do? .onAppear { Controller() } When showing code, paste it as text and put it in a code block. The code block button is the fourth button from the left in the group of formatting buttons at the bottom of the post editor. You can also use Markdown syntax for a code block by putting three backticks on the line above and below the code in the block. https://www.markdownguide.org/extended-syntax/#fenced-code-blocks Code is easier to read in a text block than in a screenshot. Plus, people can copy and paste the text from a code block.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Error setting up git hub
Are you trying to put your Xcode project on GitHub? Or do you have an existing project on GitHub that you want to import in Xcode? To put your Xcode project on GitHub, open the source control navigator in Xcode by pressing Cmd-2 and create a remote branch. To work on a GitHub project in Xcode, clone the project by choosing Source Control > Clone in Xcode. Is there an article on how to setup github with xcode? The following article may help: https://www.swiftdevjournal.com/putting-your-xcode-project-on-github-bitbucket-or-gitlab/
Replies
Boosts
Views
Activity
Jun ’23
Reply to Apple Mac install XCODE getting error when trying to install update - won't run without it
What version of Xcode is installed on your Mac? Gone to open, wants to install update. But errors when tries so can no longer use. What specifically happens when you try to launch Xcode and it asks to install and update? List each step you take and be specific. The people on this forum aren't sitting next to you in front of your Mac. They can't read your mind. They can only go by what you write here. And you didn't write enough for people to help you.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Crash: Thread 2: "-[NSTaggedPointerString count]: unrecognized selector sent to instance 0xaa672ff3b4678003"
There is nothing obvious in your code that causes the crash, making this a tough error to fix. Start by adding an exception breakpoint to your project. When your app crashes Xcode will pause and show you the line of code where the crash. You can also set a breakpoint at the start of the updateLocalizedTexts function, which is the function that gets called when the app finishes launching. Then you can step through the code line by line to figure out what is causing the crash. The following article should help if you have never used Xcode's debugger before: https://www.swiftdevjournal.com/an-introduction-to-xcodes-debugger/
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’23
Reply to Xcode bug
Your app most likely has crashed. To see where the app is crashing, create an exception breakpoint in Xcode by choosing Debug > Breakpoints > Create Exception Breakpoint. If the app crashes Xcode will pause the app where the crash occurs. The following article may help: https://www.swiftdevjournal.com/fixing-and-avoiding-crashes-in-swift-code/
Replies
Boosts
Views
Activity
May ’23
Reply to XCode multiple versions on one host. How?
Yes, you can install multiple versions of Xcode. You can switch between different versions by opening a particular version, like any other Mac app. The Xcodes app simplifies installing multiple versions of Xcode and switching between them. https://github.com/XcodesOrg/XcodesApp
Replies
Boosts
Views
Activity
May ’23
Reply to Bug in SwiftUI List view
I can reproduce the behavior. The following Stack Overflow question has a workaround: https://stackoverflow.com/questions/56561064/swiftui-multiple-buttons-in-a-list-row You can file a bug report with Apple on this by choosing Help > Report an Issue in Xcode.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to ld: symbol(s) not found for architecture x86_64
Please list the steps in detail on what you did to create the code and compile it. The information you provided isn't enough for people to answer your question. Providing more details on what you did to create the code and compile it will give people here a chance to give you a helpful answer. You tagged your question as Xcode, but your screenshot looks like Visual Studio Code. Did you create a project in Xcode or create a C++ file in Visual Studio Code? Does you MacBook have an Intel processor or an Apple Silicon (M1 or M2 chip)? The linker error says it can't find a main function for the Intel architecture.
Replies
Boosts
Views
Activity
May ’23
Reply to SwiftUI
The usual cause of the "Closure containing a declaration cannot be used with result builder ViewBuilde" error is doing something besides showing views inside the body of a SwiftUI view. If you do something like declare a function or make a network call inside the body of a SwiftUI view, you will get this error. If you want a fix for the error, show the code for the SwiftUI view where you get this error. Without that code, no one can tell you the mistake you made that caused the error or tell you what you need to do to fix the error.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’23