Post

Replies

Boosts

Views

Activity

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 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 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 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 Using Document Picker to access files inside app directories
A document picker can't access files inside the app bundle. Use the methods in the Bundle class to load files from the app bundle. If you have documents in the app bundle that you want people to open in the app, copy the documents from the app bundle to the app's Documents directory. The FileManager class has a copyItem method to copy a file from one URL to another.
Topic: App & System Services SubTopic: Core OS Tags:
Sep ’22
Reply to Xcode 12.4 builds do not install on devices using iOS 15
What version of iOS is the device running? What version of the iOS 15 support files did you install? Be more specific than iOS 15, such as iOS 15.6. If the device is running a newer version of iOS than the iOS SDK/Support Files, you won't be able to install the app on the device. I have seen multiple questions on these forums about people unable to install apps built with Xcode 13.4.1 on devices running iOS 15.6. Search these forums for those posts, and you might find a workaround. If you're going to use an older Xcode version, turn off automatic updates on your device. Updating iOS requires updating Xcode or installing iOS support files.
Aug ’22
Reply to URL-Session is not working in Command Line App but in Playground
Does the app have the App Sandbox turned on? If so, network connections might be turned off so the networking code won't do anything. There are checkboxes to turn on network connections in the App Sandbox. To check if the app has the App Sandbox turned on, open the project editor by selecting the project from the left side of the project window. Select the app from the target list on the left side of the project editor. Click the App Capabilities button at the top of the project editor.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’22
Reply to ipa archived on macOS 11.4 cannot be installed
For anyone to help you, you need to supply more information: How are you installing the app? What version of iOS is the device running? What version of Xcode did you use to archive the app? What version of the iOS SDK did you use to archive the app? The site Xcode Releases (https://xcodereleases.com) lists the SDK for each Xcode version. I know that apps submitted to the App Store must be built with the iOS 15 SDK. I don't know if that restriction applies when installing an app on your own device. Updating to the latest non-beta version of Xcode may solve your problem. At the very least you will be archiving with the iOS 15 SDK.
Aug ’22
Reply to HTTP Status 400 – Bad Request
I have two suggestions to help you figure out what's going wrong. First, set a breakpoint at the start of the postTaniTalep function. Step through the code line by line and check that everything in the request is what you expect to see. If you haven't used Xcode's debugger before, the following article will help you: https://www.swiftdevjournal.com/an-introduction-to-xcodes-debugger/ Second, you have the following line of code to make the network call: let (data, response) = try await URLSession.shared.data(for: request) The code uses try. Code with try can throw errors, but you don't handle them. Wrap the network call in a do-catch block and at least print the error in the catch part of the block. The error message you get should be more helpful than "400 Bad Request".
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Multipage PDF with PDFKit on macOS with swift
There are two ways to create PDFs on Mac. The first is to use NSPrintOperation, which is in the AppKit framework. The second is to use the Quartz framework. If you have a lot of text, using Core Text with Quartz may help. The following article shows what you need to do to create a PDF with Quartz and Core Text: https://www.meandmark.com/blog/2016/08/creating-pdfs-with-core-text-and-quartz/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22