I use this line of code in an app with XCode 10 in order to dim the home indicator on iPhone X and associated edgeless apple devices.
override func prefersHomeIndicatorAutoHidden() -> Bool {
return true
}
Now the funny thing is, I have an exact copy of this app and on one copy the code works, whilst on the over the code does not compile:
Method does not override any method from its superclass
Indeed when I start typing "prefers..." , prefersHomeIndicatorAutoHidden appears as a read-only property on the one hand, whilst it does appear as a method on the other hand, and gets the override prefix by default.
Thanks for taking the time,
Best
EDIT WITH SOLUTIONS thanks to @inokey
Solution 1: check deployment (starting i0S 12, prefersHomeIndicatorAutoHidden
cannot be overridden as a method)
Solution 2 :
override var prefersHomeIndicatorAutoHidden : Bool { return true }
I assume that default deploy target in Xcode 10 is 12 and your previous project is 11 or 10, so it just reflects the changes in API.
Changes in SDK indicate that this was changed
in Xcode 10 = Swift 4.2 (Sep 2018)
Just use the code below:
override var prefersHomeIndicatorAutoHidden: Bool { return true }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With