uikitformac

How to open file dialog with SwiftUI on platform “UIKit for Mac”?

耗尽温柔 提交于 2020-11-30 12:34:48
问题 NSOpenPanel is not available on platform "UIKit for Mac": https://developer.apple.com/documentation/appkit/nsopenpanel If Apple doesn't provide a built-in way, I guess someone will create a library based on SwiftUI and FileManager that shows the dialog to select files. 回答1: Here's a solution to select a file for macOS with Catalyst & UIKit In your swiftUI view : Button("Choose file") { let picker = DocumentPickerViewController( supportedTypes: ["log"], onPick: { url in print("url : \(url)") }

Xcode 11 Beta 3, build error “Unknown attribute 'State'”, “Use of undeclared type 'View'” etc

こ雲淡風輕ζ 提交于 2020-01-20 08:38:12
问题 I build an app with the 2nd beta of Xcode 11, using SwiftUI, and everything worked completely fine, but now, with the 3rd beta, the app isn't even build. I get errors like "Use of undeclared type 'View'", "Unknown attribute 'State'" etc. What can I do? Is the problem in my code or is it just a bug? The problem is when I'm trying to build the app to run on my Mac (with UIKit for Mac) @State var score = 0 The error is "Unknown attribute 'State'" struct ContentView : View { /*...*/ } The error

Xcode 11 not recognizing static library's architecture: MacCatalyst (aka UIKitForMac)

帅比萌擦擦* 提交于 2019-12-22 04:49:06
问题 After getting excited about 2019's WWDC announcements, I tried compiling my existing iOS app against the MacOS using Xcode 11.0 beta. Unfortunately, it didn't go as expected. Xcode says my static library is built for < unknown > architecture: Building for UIKit for Mac, but the linked library 'libssl.a' was built for < unknown >. You may need to restrict the platforms for which this library should be linked in the target editor. But when I check my static libs, I can see they do contain the

Xcode 11 - Disable resize mode in catalyst swift

女生的网名这么多〃 提交于 2019-12-07 01:15:15
问题 We are converting our Swift based iOS app to Mac compatible using Catalyst in Xcode 11. We are facing an issue in UI when user resize app window. So can we disable resize mode and give fix frame for app window? 回答1: Beta 5 added a sizeRestrictions property to UIWindowScene. If you set sizeRestrictions.maximumSize and sizeRestrictions.minimumSize to the same value, the window will not be resizable: windowScene.sizeRestrictions?.minimumSize = CGSize(width: 640, height: 480) windowScene

Xcode 11 not recognizing static library's architecture: MacCatalyst (aka UIKitForMac)

隐身守侯 提交于 2019-12-05 09:25:38
After getting excited about 2019's WWDC announcements, I tried compiling my existing iOS app against the MacOS using Xcode 11.0 beta. Unfortunately, it didn't go as expected. Xcode says my static library is built for < unknown > architecture: Building for UIKit for Mac, but the linked library 'libssl.a' was built for < unknown >. You may need to restrict the platforms for which this library should be linked in the target editor. But when I check my static libs, I can see they do contain the desired architecture x86_64 : I believe this issue may be related to an Xcode Beta bug. Does anyone have

Xcode 11 Beta 3, build error “Unknown attribute 'State'”, “Use of undeclared type 'View'” etc

独自空忆成欢 提交于 2019-11-29 17:26:35
I build an app with the 2nd beta of Xcode 11, using SwiftUI, and everything worked completely fine, but now, with the 3rd beta, the app isn't even build. I get errors like "Use of undeclared type 'View'", "Unknown attribute 'State'" etc. What can I do? Is the problem in my code or is it just a bug? The problem is when I'm trying to build the app to run on my Mac (with UIKit for Mac) @State var score = 0 The error is "Unknown attribute 'State'" struct ContentView : View { /*...*/ } The error is "Use of undeclared type 'View'" This is from the Xcode 11 Beta 3 Release Notes . Known Issues Xcode