ios13

Disable gesture to pull down form/page sheet modal presentation

主宰稳场 提交于 2019-11-30 17:28:15
In iOS 13 modal presentations using the form and page sheet style can be dismissed with a pan down gesture. This is problematic in one of my form sheets because the user draws into this box which interferes with the gesture. It pulls the screen down instead of drawing a vertical line. How can you disable the vertical swipe to dismiss gesture in a modal view controller presented as a sheet? Setting isModalInPresentation = true still allows the sheet to be pulled down, it just won't dismiss. For future internet travelers, in general, one shouldn't disable the swipe to dismiss functionality. But

How to present an Alert with swiftUI

谁说胖子不能爱 提交于 2019-11-30 14:57:21
问题 In swiftUI I discovered the Alert type. But I wonder how to show it with the presentation method. Initializing an Alert is pretty easy. But how to use the binding? struct ContentView : View { var body: some View { Button(action: { // Don't know how to use the `binding` below presentation(binding, alert: { Alert(title: Text("Hello")) }) }, label: { Text("asdf") }) } } The binding is of type Binding<Bool> 回答1: You can use a @State variable as the binding. Alternatively you can use a

After upgrade to iOS13 beta 6/Xcode 11 beta 5: issue “dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc”

时光毁灭记忆、已成空白 提交于 2019-11-30 12:15:06
After upgrading to iOS13 beta 6 using Xcode 11 beta 5 I receive this message when running on an iPhone SE device. dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc Referenced from: /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI in /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp Using the simulator there's no such message, and it has been ok with iOS13 beta 5 on the device, tool Compiling is fine, the message is

How to change the status bar background color and text color on iOS 13?

你。 提交于 2019-11-30 00:31:08
With the arrival of iOS 13 statusBar's view is no longer accessible trough: value(forKey: "statusBar") as? UIView Due to: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.' But it's not clear how it should be used for changing colours as keyWindow?.windowScene?.statusBarManager does not appear to contain anything related to it. I'm compiling my code with

After upgrade to iOS13 beta 6/Xcode 11 beta 5: issue “dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc”

家住魔仙堡 提交于 2019-11-29 18:03:27
问题 After upgrading to iOS13 beta 6 using Xcode 11 beta 5 I receive this message when running on an iPhone SE device. dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc Referenced from: /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI in /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp Using the simulator there's no such

SwiftUI : Picker does not update correctly when changing datasource

非 Y 不嫁゛ 提交于 2019-11-29 15:04:03
问题 I have just started learning SwiftUI and got stuck somewhere! I am trying to change segment styled picker datasource when changing value of another segment. But somehow it is not working as expected! Or else I might have coded something wrong. Can anyone figure it out please? Here is my piece of code: import SwiftUI struct ContentView: View { @State var selectedType = 0 @State var inputUnit = 0 @State var outputUnit = 1 let arrTypes = ["Temperature", "Length"] var arrData: [String] { switch

How can I check whether dark mode is enabled in iOS/iPadOS?

半世苍凉 提交于 2019-11-29 11:26:32
问题 Starting from iOS/iPadOS 13, a dark user interface style is available, similar to the dark mode introduced in macOS Mojave. How can I check whether the user has enabled the system-wide dark mode? 回答1: You should check the userInterfaceStyle variable of UITraitCollection , same as on tvOS and macOS. switch traitCollection.userInterfaceStyle { case .light: //light mode case .dark: //dark mode case .unspecified: //the user interface style is not specified } You should use the

App crashes when playing audio on iOS13.1

六眼飞鱼酱① 提交于 2019-11-29 06:20:44
问题 I am building an app that runs sound files from within the main bundle with a url. When I tested this on iOS 13, everything is fine. But with the new update of 13.1 I am getting an error here on the line of code backgroundMusicPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: sound!)) that says: Thread 1: EXC_BAD_ACCESS (code=1, address=0x48 Here is the code that I am using in a custom class that runs background music when the app launches: import Foundation import AVFoundation var

App delegate methods aren't being called in iOS 13

二次信任 提交于 2019-11-28 21:25:54
问题 I am using Xcode 11 and building an app for iOS 13. In a new project I created in Xcode some of the UIApplicationDelegate methods were missing so I added them back into the app delegate file. The new template for a "Single View App" project was missing the methods. The problem is that none of the delegate methods are getting called except -application:didFinishLaunchingWithOptions: . Here is my app delegate: @implementation AppDelegate - (BOOL)application:(UIApplication *)application

iOS 13 disable Dark Mode changes [duplicate]

99封情书 提交于 2019-11-28 11:53:38
This question already has an answer here: Is it possible to opt-out of dark mode on iOS 13? 4 answers My application isn't prepared for Dark Mode and I'm not going to work on it today. Is there a way to disable Dark Mode changes for my app? Here is where Apple discusses opting out of light or dark mode: This section applies to Xcode 11 usage The code below will opt out a specific view controller: override func viewDidLoad() { super.viewDidLoad() // overrideUserInterfaceStyle is available with iOS 13 if #available(iOS 13.0, *) { // Always adopt a light interface style.