SwiftUI @Binding Initialize

When you use your LoggedInView in your app you do need to provide some binding, such as an @State from a previous view or an @EnvironmentObject. For the special case of the PreviewProvider where you just need a fixed value you can use .constant(false) E.g. #if DEBUG struct LoggedInView_Previews : PreviewProvider { static var previews: … Read more

Disable gesture to pull down form/page sheet modal presentation

In general, you shouldn’t try to disable the swipe to dismiss functionality, as users expect all form/page sheets to behave the same across all apps. Instead, you may want to consider using a full-screen presentation style. If you do want to use a sheet that can’t be dismissed via swipe, set isModalInPresentation = true, but … Read more

How to change the colors of a segment in a UISegmentedControl in iOS 13?

As of iOS 13b3, there is now a selectedSegmentTintColor on UISegmentedControl. To change the overall color of the segmented control use its backgroundColor. To change the color of the selected segment use selectedSegmentTintColor. To change the color/font of the unselected segment titles, use setTitleTextAttributes with a state of .normal/UIControlStateNormal. To change the color/font of the … Read more

Detecting sheet was dismissed on iOS 13

Is there a way to detect that the presented view controller sheet was dismissed? Yes. Some other function I can override in the parent view controller rather than using some sort of delegate? No. “Some sort of delegate” is how you do it. Make yourself the presentation controller’s delegate and override presentationControllerDidDismiss(_:). https://developer.apple.com/documentation/uikit/uiadaptivepresentationcontrollerdelegate/3229889-presentationcontrollerdiddismiss The lack … Read more

Disable the interactive dismissal of presented view controller

Option 1: viewController.isModalInPresentation = true (Disabled interactive .pageSheet dismissal acts like this.) Since the iOS 13, UIViewController contains a new property called isModalInPresentation which must be set to true to prevent the interactive dismissal. It basically ignores events outside the view controller’s bounds. Bear that in mind if you are using not only the automatic … Read more

Is it possible to opt-out of dark mode on iOS 13?

First, here is Apple’s entry related to opting out of dark mode. The content at this link is written for Xcode 11 & iOS 13: Entire app via info.plist file (Xcode 12) Use the following key in your info.plist file: UIUserInterfaceStyle And assign it a value of Light. The XML for the UIUserInterfaceStyle assignment: <key>UIUserInterfaceStyle</key> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)