[Valet 4.0] Adopt Swift 5 syntax, and enable support for SinglePromptSecureEnclaveValet on tvOS#191
[Valet 4.0] Adopt Swift 5 syntax, and enable support for SinglePromptSecureEnclaveValet on tvOS#191dfed merged 2 commits intodevelop--4.0from
Conversation
| import Foundation | ||
|
|
||
|
|
||
| @available(macOS 10.11, *) |
There was a problem hiding this comment.
Our minimum supported target on macOS is macOS 10.11. So there is no need to specify availability in this case.
| // | ||
|
|
||
| #if os(iOS) || os(macOS) | ||
| #if canImport(LocalAuthentication) |
There was a problem hiding this comment.
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.
Do we still need the @available(tvOS 10.0, *) given the canImport here?
There was a problem hiding this comment.
Yup. If I get rid of it we get build failures 🙂. Here's my understanding as to why:
#if canImportis a compiler flag that enables a class for compilation in the case where the SDK has access to the library in question.@availableis 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
| // | ||
|
|
||
| #if os(iOS) || os(macOS) | ||
| #if canImport(LocalAuthentication) |
There was a problem hiding this comment.
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) | ||
|
|
Built on top of #190. This PR leans into Swift 5 syntax, and utilizes
#canImportto bringSinglePromptSecureEnclaveValettotvOS