-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Valet 4.0] Adopt Swift 5 syntax, and enable support for SinglePromptSecureEnclaveValet on tvOS #191
Conversation
@@ -21,7 +21,6 @@ | |||
import Foundation | |||
|
|||
|
|||
@available(macOS 10.11, *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our minimum supported target on macOS is macOS 10.11. So there is no need to specify availability in this case.
@@ -18,14 +18,14 @@ | |||
// limitations under the License. | |||
// | |||
|
|||
#if os(iOS) || os(macOS) | |||
#if canImport(LocalAuthentication) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're no longer supporting Xcode 9, we can use canImport
to enable SinglePromptSecureEnclaveValet
on tvOS 10+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the @available(tvOS 10.0, *)
given the canImport
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. If I get rid of it we get build failures 🙂. Here's my understanding as to why:
#if canImport
is a compiler flag that enables a class for compilation in the case where the SDK has access to the library in question.@available
is a SDK flag that makes a class as available on particular OS versions.
As such, when we're targeting a tvOS
SDK on Xcode 11, LocalAuthentication
can always be imported because Xcode 11's SDK has LocalAuthentication
on tvOS
. We still need to limit the availability of the class that is now bundled in our tvOS
library to ensure there are no crashes when running this code on tvOS 9.
a1c30ff
to
15935a3
Compare
921aa52
to
f087d9e
Compare
f087d9e
to
e9848e0
Compare
3d77f73
to
6c8e49b
Compare
be69dc7
to
339a27d
Compare
@@ -18,14 +18,14 @@ | |||
// limitations under the License. | |||
// | |||
|
|||
#if os(iOS) || os(macOS) | |||
#if canImport(LocalAuthentication) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the @available(tvOS 10.0, *)
given the canImport
here?
Sources/Valet/Valet.swift
Outdated
return valet | ||
CloudAccessibility.allValues().map { cloudAccessibility in | ||
shared ? .iCloudSharedAccessGroupValet(with: identifier, accessibility: cloudAccessibility) : .iCloudValet(with: identifier, accessibility: cloudAccessibility) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no newline here
Built on top of #190. This PR leans into Swift 5 syntax, and utilizes
#canImport
to bringSinglePromptSecureEnclaveValet
totvOS