Post

Replies

Boosts

Views

Activity

Reply to InputAccessoryView with SwiftUI
There's a new API to do this in iOS 15. Note that this is not compatible with previous versions of iOS. You'll also need Xcode 13 beta to build this. See more at https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-toolbar-to-the-keyboard struct ContentView: View { @State private var name = "Taylor" var body: some View { TextField("Enter your name", text: $name) .textFieldStyle(.roundedBorder) .toolbar { ToolbarItemGroup(placement: .keyboard) { Button("Click me!") { print("Clicked") } } } } } Alternatively, you can wrap a UITextView inside your SwiftUI view using UIViewRepresentable. You can then gain access to inputAccessoryView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Bug with image picker : When tapping on the album button the camera opens up
You should implement the updateUIViewController method. When the state of your view is changed, this method is called and you are responsible to update the configuration of your view controller to match the new state information. See more at https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable/updateuiviewcontroller(_:context:) func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<ImagePicker>) {         uiViewController.sourceType = sourceType }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to How to register background tasks in a pure SwiftUI app
You can register the task inside the init function of the App struct. @main struct MyApp: App { init(){ // Your code } var body: some Scene { WindowGroup { ContentView() } } } Or, to use AppDelegate in a SwiftUI lifecycle app, first create a custom class of App Delegate. class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } } Then use UIApplicationDelegateAdaptor property wrapper to tell SwiftUI to use your AppDelegate class. @main struct MyApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { ContentView() } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Please tell me how to remove highlight from editmenu items of PDFView
DTS was unable to provide a workaround. Instead, I was suggested to file a bug report at Feedback Assistant. Here is the Feedback ID: FB13243494.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Please tell me how to remove highlight from editmenu items of PDFView
I have the same question. I submitted a DTS ticket and will post the result here.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to Simulator beta 15 is too slow
Same on my M1 Mac mini (16/256).
Replies
Boosts
Views
Activity
Sep ’23
Reply to WKWebView evaluateJavascript method crash with async/await when javascript call doesn't have return value
Apple please fix this!
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Xcode Cloud + dynamic library package
I have the same problem using a swift package with binary target.
Replies
Boosts
Views
Activity
Mar ’22
Reply to InputAccessoryView with SwiftUI
There's a new API to do this in iOS 15. Note that this is not compatible with previous versions of iOS. You'll also need Xcode 13 beta to build this. See more at https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-toolbar-to-the-keyboard struct ContentView: View { @State private var name = "Taylor" var body: some View { TextField("Enter your name", text: $name) .textFieldStyle(.roundedBorder) .toolbar { ToolbarItemGroup(placement: .keyboard) { Button("Click me!") { print("Clicked") } } } } } Alternatively, you can wrap a UITextView inside your SwiftUI view using UIViewRepresentable. You can then gain access to inputAccessoryView.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Bug with image picker : When tapping on the album button the camera opens up
You should implement the updateUIViewController method. When the state of your view is changed, this method is called and you are responsible to update the configuration of your view controller to match the new state information. See more at https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable/updateuiviewcontroller(_:context:) func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<ImagePicker>) {         uiViewController.sourceType = sourceType }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Bug with image picker : When tapping on the album button the camera opens up
Can you also provide your implementation of ImagePicker?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Disable Line Wrapping in UITextView wrapped in UIViewRepresentable
You can wrap it inside a SwiftUI ScrollView instead. ScrollView { InputView(text: $input)     .padding() } You'll also need to disable scrolling of the TextView. To do that, add this inside makeUIView(). textView.isScrollEnabled = false
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to register background tasks in a pure SwiftUI app
You can register the task inside the init function of the App struct. @main struct MyApp: App { init(){ // Your code } var body: some Scene { WindowGroup { ContentView() } } } Or, to use AppDelegate in a SwiftUI lifecycle app, first create a custom class of App Delegate. class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { return true } } Then use UIApplicationDelegateAdaptor property wrapper to tell SwiftUI to use your AppDelegate class. @main struct MyApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { ContentView() } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to File does not exist error - but it does
By default, macOS apps built on Xcode are sandboxed. This means they can only access the data within the app directory. You can either disable sandbox capability in the Signing & Capabilities tab or bundle the executable in your app.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Safari Web Inspector tabs are missing
Same here. On Big Sur 11.5 Beta and iOS 14.5.5 / 14.4.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’21