Post

Replies

Boosts

Views

Activity

Reply to Xcode 14 / iOS 16 - UIViewRepresentables must be value types
Were you able to use a class in earlier Xcode versions? I am almost 100 percent sure you have to make PlayerView a struct. SwiftUI views are structs. The UIViewRepresentable protocol lets you wrap UIKit views to use them in SwiftUI apps, essentially converting UIKit views to SwiftUI views. Therefore views that use UIViewRepresentable must be structs. Create a new class that has the @Published property and the Combine publishers. Add an instance of the class to PlayerView. That way you can use the @Published property and have the view be a struct.
Sep ’22
Reply to Swiftui MacOS App Example Project OnDelete func
If you are talking about removing items from SwiftUI lists, the modifier for Mac apps is .onDeleteCommand instead of .onDelete, which iOS apps use. For anyone to provide more help, you have to provide the code to delete the item from Core Data and the SwiftUI code for deleting items. The following article may help you: https://www.swiftdevjournal.com/removing-items-from-swiftui-lists-in-mac-apps/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to SwiftUI Tutorial Application Alleged Incompatibility with macOS
I took a look at the tutorial and I saw nothing in it that requires macOS 13. Can you clarify what you were doing when you got the error messages? Did the errors occur when you were typing code or when you build the project? At that point in the tutorial, it says the previews won't work because of the new stuff you typed. The next section in the tutorial fixes the problem.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to SwiftUI Tutorial Application Alleged Incompatibility with macOS
You don't need to restart the tutorial. The SwiftUI previews are flaky. Try turning off the preview canvas when entering the code for the preview and turning it back on when you're done typing the code. If you don't know how to turn off the preview canvas, read the following: https://swiftdevjournal.github.io/intro-swiftui-guide/Previews If you are still having problems with the canvas, you can turn off the preview canvas and run the project in the Simulator. The Simulator takes a long time to launch the first time you run the project, but after that, building and running the project isn't much slower than the preview canvas.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to SpriteKit - How do I learn to use this?
You can find the book 2D Apple Games by Tutorials at the following URL: https://github.com/raywenderlich/deprecated-books SpriteKit hasn't changed much since the book came out. The biggest issue you'll have to deal with is Xcode changes. The following sites has some introductory articles on using SpriteKit: https://www.checksimgames.com/
Topic: App & System Services SubTopic: Core OS Tags:
Oct ’22
Reply to One Xcode project, different SDKs for different architectures
You don't need to use multiple SDKs. You can use the latest SDK and support older OS versions. If you want to support macOS 10.10, set the deployment target to 10.10. You have to be careful to avoid using anything Apple introduced in later OS versions. For example to using SwiftUI in a Mac app will not allow the app to run on anything earlier than 10.15. Take a look at the following articles for more details: https://www.swiftdevjournal.com/supporting-older-versions-of-ios-and-macos/ https://www.swiftdevjournal.com/using-new-api-features-in-swift-while-supporting-older-os-versions/
Oct ’22
Reply to C Programming
I'm just checking if I'm doing anything wrong No one here can tell you if you're doing anything wrong because you haven't mentioned what you're doing other than doing some C programming. Some information that would let people help you would include the following: The version of Xcode you're running The version of macOS you're running The Mac model you're using, amount of RAM, and amount of storage The type of Xcode project you created The number of files in the project The specific activity that causes the beach ball: opening the project, selecting a file, editing code, building the project, etc. Do you have any large files (tens of thousands of lines of code) in the project? Are you using any external libraries?
Nov ’22
Reply to upgraded to OS Monterey and Xcode 14.1, Xcode won't work because I done have an info file
The Packaging collection of build settings has the build settings for automatically generating an Info.plist file. To access the build settings, Select your project from the left side of the project window to open the project editor. Select the app target from the left side of the project editor. Click the Build Settings button at the top of the project editor. Typing Info.plist in the search field in the build settings list will show the build settings that deal with the Info.plist file.
Nov ’22
Reply to Differences between "Obj-C in iOS App Development" and "Obj-C in MacOS CommandLine Development"
Objective-C takes the C language and adds support for object-oriented programming. The function example you showed for iOS is an example of an Objective-C method. A method is a function that is part of a class. Objective-C methods put the return type in parentheses, (void). Objective-C has two types of methods: instance and class. An instance method starts with - while a class method starts with +. You showed an example of an instance method. The function example you showed for Mac is an example of a C function. Objective-C supports C functions. C functions do not put the return type in parentheses. C does not have classes so it does not have methods. Apple provides the following guide to Objective-C: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html The following book teaches Objective-C for people who already know Swift: https://www.hackingwithswift.com/store/objective-c-for-swift-developers
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to Prevent Save Panel in SwiftUI Mac app from saving as file type my app exports
This question got a response in Apple's Q & A Slack https://appledeveloper.slack.com/archives/C043025CS59/p1670878510681929 The suggestion was to limit the content types using the .fileExporter modifier. I haven't written any code to open a Save panel when saving the document. I have the default SwiftUI behavior. How would I use .fileExporter when someone chooses File > Save?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Xcode 14 / iOS 16 - UIViewRepresentables must be value types
Were you able to use a class in earlier Xcode versions? I am almost 100 percent sure you have to make PlayerView a struct. SwiftUI views are structs. The UIViewRepresentable protocol lets you wrap UIKit views to use them in SwiftUI apps, essentially converting UIKit views to SwiftUI views. Therefore views that use UIViewRepresentable must be structs. Create a new class that has the @Published property and the Combine publishers. Add an instance of the class to PlayerView. That way you can use the @Published property and have the view be a struct.
Replies
Boosts
Views
Activity
Sep ’22
Reply to Swiftui MacOS App Example Project OnDelete func
If you are talking about removing items from SwiftUI lists, the modifier for Mac apps is .onDeleteCommand instead of .onDelete, which iOS apps use. For anyone to provide more help, you have to provide the code to delete the item from Core Data and the SwiftUI code for deleting items. The following article may help you: https://www.swiftdevjournal.com/removing-items-from-swiftui-lists-in-mac-apps/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to SwiftUI Tutorial Application Alleged Incompatibility with macOS
I took a look at the tutorial and I saw nothing in it that requires macOS 13. Can you clarify what you were doing when you got the error messages? Did the errors occur when you were typing code or when you build the project? At that point in the tutorial, it says the previews won't work because of the new stuff you typed. The next section in the tutorial fixes the problem.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to SwiftUI Tutorial Application Alleged Incompatibility with macOS
You don't need to restart the tutorial. The SwiftUI previews are flaky. Try turning off the preview canvas when entering the code for the preview and turning it back on when you're done typing the code. If you don't know how to turn off the preview canvas, read the following: https://swiftdevjournal.github.io/intro-swiftui-guide/Previews If you are still having problems with the canvas, you can turn off the preview canvas and run the project in the Simulator. The Simulator takes a long time to launch the first time you run the project, but after that, building and running the project isn't much slower than the preview canvas.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to xcode 14 and ios 10.3
The earliest iOS version Xcode 14 supports is iOS 11. Install Xcode 13.4 if you need to test your app on a device running iOS 10.
Replies
Boosts
Views
Activity
Oct ’22
Reply to SpriteKit - How do I learn to use this?
You can find the book 2D Apple Games by Tutorials at the following URL: https://github.com/raywenderlich/deprecated-books SpriteKit hasn't changed much since the book came out. The biggest issue you'll have to deal with is Xcode changes. The following sites has some introductory articles on using SpriteKit: https://www.checksimgames.com/
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to One Xcode project, different SDKs for different architectures
You don't need to use multiple SDKs. You can use the latest SDK and support older OS versions. If you want to support macOS 10.10, set the deployment target to 10.10. You have to be careful to avoid using anything Apple introduced in later OS versions. For example to using SwiftUI in a Mac app will not allow the app to run on anything earlier than 10.15. Take a look at the following articles for more details: https://www.swiftdevjournal.com/supporting-older-versions-of-ios-and-macos/ https://www.swiftdevjournal.com/using-new-api-features-in-swift-while-supporting-older-os-versions/
Replies
Boosts
Views
Activity
Oct ’22
Reply to Storing my app folders in a folder doesn't work?
The .git folder isn't visible in the Finder because files and folders that start with a dot are hidden by default. Press Cmd-Shift-Dot to show hidden files, like the .git folder, in the Finder.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to xcode MAC project UIKIT IMPORT FRAMEWORK PACKAGE
UIKit is an iOS framework. It is not available for Mac apps unless you are using Mac Catalyst to make a Mac version of an iOS app. AppKit is the Mac equivalent of UIKit. Import the Cocoa framework to import AppKit.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to Local testing of swift Playgrounds App on iPad
Can you be more specific about what you mean by "locally test the app"? Tapping the Run button in Swift Playgrounds runs the app. Is there something else you also need to do?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to C Programming
I'm just checking if I'm doing anything wrong No one here can tell you if you're doing anything wrong because you haven't mentioned what you're doing other than doing some C programming. Some information that would let people help you would include the following: The version of Xcode you're running The version of macOS you're running The Mac model you're using, amount of RAM, and amount of storage The type of Xcode project you created The number of files in the project The specific activity that causes the beach ball: opening the project, selecting a file, editing code, building the project, etc. Do you have any large files (tens of thousands of lines of code) in the project? Are you using any external libraries?
Replies
Boosts
Views
Activity
Nov ’22
Reply to Can't find NavigationStack in autocomplete and can't run playground apps on MacOS
Can you run the app on the Mac version of the Swift Playgrounds app? What version of Xcode are you running? You need Xcode 14.1 to use NavigationStack on Mac. You can download and install Xcode 14.1 from Apple's developer site. You can find a direct download link at Xcode Releases. https://xcodereleases.com/
Replies
Boosts
Views
Activity
Nov ’22
Reply to upgraded to OS Monterey and Xcode 14.1, Xcode won't work because I done have an info file
The Packaging collection of build settings has the build settings for automatically generating an Info.plist file. To access the build settings, Select your project from the left side of the project window to open the project editor. Select the app target from the left side of the project editor. Click the Build Settings button at the top of the project editor. Typing Info.plist in the search field in the build settings list will show the build settings that deal with the Info.plist file.
Replies
Boosts
Views
Activity
Nov ’22
Reply to Differences between "Obj-C in iOS App Development" and "Obj-C in MacOS CommandLine Development"
Objective-C takes the C language and adds support for object-oriented programming. The function example you showed for iOS is an example of an Objective-C method. A method is a function that is part of a class. Objective-C methods put the return type in parentheses, (void). Objective-C has two types of methods: instance and class. An instance method starts with - while a class method starts with +. You showed an example of an instance method. The function example you showed for Mac is an example of a C function. Objective-C supports C functions. C functions do not put the return type in parentheses. C does not have classes so it does not have methods. Apple provides the following guide to Objective-C: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html The following book teaches Objective-C for people who already know Swift: https://www.hackingwithswift.com/store/objective-c-for-swift-developers
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Prevent Save Panel in SwiftUI Mac app from saving as file type my app exports
This question got a response in Apple's Q & A Slack https://appledeveloper.slack.com/archives/C043025CS59/p1670878510681929 The suggestion was to limit the content types using the .fileExporter modifier. I haven't written any code to open a Save panel when saving the document. I have the default SwiftUI behavior. How would I use .fileExporter when someone chooses File > Save?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’22