Post

Replies

Boosts

Views

Activity

Reply to Open CSS files in MacOS document-based App
If the CSS files still aren't selectable, delete the document type you have with the identifier com.example.plain-text. In a test project what I had to do to make CSS files selectable was to have one CSS document type for the app with identifier public.css and an imported type identifier for CSS with identifier public.css. Unfortunately the project editor won't let you delete a document type. You will have to select the Info.plist file from the left side of the project window to delete a document type.
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’22
Reply to Multiple Type in MacOS Document-based App
The Open and Save panels for an app that uses NSDocument are initially configured to only allow opening and saving files of your document type. If you want to read and write multiple file types, you must create imported and exported UTIs (Uniform Type Identifiers) for those file types. NSDocument has a readableTypes and a writableTypes property for the types a document type supports, but they provide only get methods. You can't set them in your app's code. To add imported and exported UTIs for your document type, take the following steps: Open the project editor by selecting the project from the left side of the project window. Select your app target from the left side of the project editor. Click the Info button at the top of the project editor. Click the disclosure triangle next to Exported Type Identifiers to access and add exported UTIs. Click the disclosure triangle next to Imported Type Identifiers to access and add imported UTIs. In SwiftUI reading and writing multiple file types is easier. SwiftUI documents have readableContentTypes and writableContentTypes properties where you can specify an array of UTTypes your file can read and write.
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’22
Reply to I can't see the option to add new package in Xcode !
If choosing File > Add Packages in Xcode doesn't provide a sheet to add the package, add the package from the project editor. Select the project from the left side of the project window to open the project editor. Select the project from the left side of the project editor. Click the Project Dependencies button at the top of the project editor. Click the Add (+) button at the bottom of the package list to add the package.
Jul ’22
Reply to Xcode has stopped working
Provide more details on what you mean when you say the following: When I checked out my account I am told that my session has timed out and I need to login.  What do you mean by "checked out my account"? What is the exact message you get telling you that you need to login? What happens if you login with your Mac user account's password instead of your Apple ID and password?
Jul ’22
Reply to Message "Expected '}' at end of brace statement"
You have four left braces in your code and only three right braces. Each left brace needs a matching right brace. Add a right brace after the second return statement. func responseTo(question: String) -> String {     if question.hasPrefix("hello") {         if lowerQuestion2.hasPrefix("hello") {             return "Hello there"         } else {             return "That really depends" } // Add the brace here to close the else block.     } // End the outer if block } // End of func
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’22
Reply to Submit an macOS app and Xcode version
You can publish Mac apps outside the App Store so you wouldn't have to use Xcode 13. If the app is free, you can host the app on your own site and provide a Download button. A paid app requires more work. You have to find a way to deal with licensing and process payments. Companies like Gumroad, Paddle, and FastSpring will help with this. The following book shows you how to sell software outside the Mac App Store: https://christiantietze.de/books/make-money-outside-mac-app-store-fastspring/
Jul ’22
Reply to How can I update my app to make it compatible with older ios versions?
Set the deployment target for the app's target to the earliest iOS version you want to support. Select the project file from the project navigator on the left side of the project window to access the deployment target. If you need more detailed instructions on setting the deployment target, read the following article: https://www.swiftdevjournal.com/supporting-older-versions-of-ios-and-macos/
Topic: Safari & Web SubTopic: General Tags:
Jul ’22
Reply to Fatal Error: UIViewControllerRepresentables must be value types: ViewControllerResolver
Does your app use UIViewControllerRepresentable? If so, is your data structure that uses UIViewControllerRepresentable a struct or a class? The error message is saying you have a class that conforms to UIViewControllerRepresentable, and that you have to use a struct instead of a class. Setting an exception breakpoint in Xcode and running the app can help you find where the app is crashing. Choose Debug > Breakpoints > Create Exception Breakpoint to set an exception breakpoint.
Jun ’22
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 Open CSS files in MacOS document-based App
If the CSS files still aren't selectable, delete the document type you have with the identifier com.example.plain-text. In a test project what I had to do to make CSS files selectable was to have one CSS document type for the app with identifier public.css and an imported type identifier for CSS with identifier public.css. Unfortunately the project editor won't let you delete a document type. You will have to select the Info.plist file from the left side of the project window to delete a document type.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Open CSS files in MacOS document-based App
The identifier for CSS files should be public.css, not com.example.css.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Learning Swift from Swift Playgrounds
Start with the Get Started with Code playground in the More Playgrounds section.
Replies
Boosts
Views
Activity
Aug ’22
Reply to Multiple Type in MacOS Document-based App
The Open and Save panels for an app that uses NSDocument are initially configured to only allow opening and saving files of your document type. If you want to read and write multiple file types, you must create imported and exported UTIs (Uniform Type Identifiers) for those file types. NSDocument has a readableTypes and a writableTypes property for the types a document type supports, but they provide only get methods. You can't set them in your app's code. To add imported and exported UTIs for your document type, take the following steps: Open the project editor by selecting the project from the left side of the project window. Select your app target from the left side of the project editor. Click the Info button at the top of the project editor. Click the disclosure triangle next to Exported Type Identifiers to access and add exported UTIs. Click the disclosure triangle next to Imported Type Identifiers to access and add imported UTIs. In SwiftUI reading and writing multiple file types is easier. SwiftUI documents have readableContentTypes and writableContentTypes properties where you can specify an array of UTTypes your file can read and write.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to Duplicate rows in List populated by CoreData
Show the code where you add the bill to Core Data and the code for AddBillView. The most likely source of your problem is in that code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to I can't see the option to add new package in Xcode !
If choosing File > Add Packages in Xcode doesn't provide a sheet to add the package, add the package from the project editor. Select the project from the left side of the project window to open the project editor. Select the project from the left side of the project editor. Click the Project Dependencies button at the top of the project editor. Click the Add (+) button at the bottom of the package list to add the package.
Replies
Boosts
Views
Activity
Jul ’22
Reply to Xcode has stopped working
Provide more details on what you mean when you say the following: When I checked out my account I am told that my session has timed out and I need to login.  What do you mean by "checked out my account"? What is the exact message you get telling you that you need to login? What happens if you login with your Mac user account's password instead of your Apple ID and password?
Replies
Boosts
Views
Activity
Jul ’22
Reply to Message "Expected '}' at end of brace statement"
You have four left braces in your code and only three right braces. Each left brace needs a matching right brace. Add a right brace after the second return statement. func responseTo(question: String) -> String {     if question.hasPrefix("hello") {         if lowerQuestion2.hasPrefix("hello") {             return "Hello there"         } else {             return "That really depends" } // Add the brace here to close the else block.     } // End the outer if block } // End of func
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Submit an macOS app and Xcode version
You can publish Mac apps outside the App Store so you wouldn't have to use Xcode 13. If the app is free, you can host the app on your own site and provide a Download button. A paid app requires more work. You have to find a way to deal with licensing and process payments. Companies like Gumroad, Paddle, and FastSpring will help with this. The following book shows you how to sell software outside the Mac App Store: https://christiantietze.de/books/make-money-outside-mac-app-store-fastspring/
Replies
Boosts
Views
Activity
Jul ’22
Reply to How can I update my app to make it compatible with older ios versions?
Set the deployment target for the app's target to the earliest iOS version you want to support. Select the project file from the project navigator on the left side of the project window to access the deployment target. If you need more detailed instructions on setting the deployment target, read the following article: https://www.swiftdevjournal.com/supporting-older-versions-of-ios-and-macos/
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Referencing static method 'buildBlock' on 'Optional' requires that 'UIImage' conform to 'View'
UIImage is part of the UIKit framework. You can't stick place an UIImage inside a SwiftUI view. You used Image twice in your code. Is there a reason you can't use Image to show the SF Symbol? The following code works for me: Image(systemName: "antenna.radiowaves.left.and.right")
Replies
Boosts
Views
Activity
Jul ’22
Reply to TextField with Double or Int not binding back ?
@State properties require you to give them an initial value. @State var test: Double? = 0.0
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Fatal Error: UIViewControllerRepresentables must be value types: ViewControllerResolver
Does your app use UIViewControllerRepresentable? If so, is your data structure that uses UIViewControllerRepresentable a struct or a class? The error message is saying you have a class that conforms to UIViewControllerRepresentable, and that you have to use a struct instead of a class. Setting an exception breakpoint in Xcode and running the app can help you find where the app is crashing. Choose Debug > Breakpoints > Create Exception Breakpoint to set an exception breakpoint.
Replies
Boosts
Views
Activity
Jun ’22
Reply to Showing a currency value with readable text in a SwiftUI Mac app
Converting the value to a string using currencyFormatter.string and displaying the string in a Text view worked. Thanks.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
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:
Replies
Boosts
Views
Activity
Jun ’22