Skip to content
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

Merged
merged 2 commits into from
Dec 31, 2019

Conversation

dfed
Copy link
Collaborator

@dfed dfed commented Dec 22, 2019

Built on top of #190. This PR leans into Swift 5 syntax, and utilizes #canImport to bring SinglePromptSecureEnclaveValet to tvOS

@@ -21,7 +21,6 @@
import Foundation


@available(macOS 10.11, *)
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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+.

Copy link
Collaborator

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?

Copy link
Collaborator Author

@dfed dfed Dec 31, 2019

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:

  1. #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.
  2. @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.

@dfed dfed mentioned this pull request Dec 22, 2019
10 tasks
@dfed dfed changed the title Adopt Swift 5 syntax, and enable support for SinglePromptSecureEnclaveValet on tvOS [Valet 4.0] Adopt Swift 5 syntax, and enable support for SinglePromptSecureEnclaveValet on tvOS Dec 22, 2019
@dfed dfed force-pushed the dfed--swift-5 branch 3 times, most recently from a1c30ff to 15935a3 Compare December 22, 2019 17:38
@dfed dfed marked this pull request as ready for review December 22, 2019 18:31
@dfed dfed force-pushed the dfed--simplify-ci-v4 branch from 921aa52 to f087d9e Compare December 23, 2019 00:14
@dfed dfed force-pushed the dfed--simplify-ci-v4 branch from f087d9e to e9848e0 Compare December 23, 2019 20:07
@dfed dfed force-pushed the dfed--swift-5 branch 2 times, most recently from 3d77f73 to 6c8e49b Compare December 23, 2019 20:32
@dfed dfed changed the base branch from dfed--simplify-ci-v4 to develop--4.0 December 24, 2019 03:28
@dfed dfed force-pushed the dfed--swift-5 branch 2 times, most recently from be69dc7 to 339a27d Compare December 24, 2019 22:05
@@ -18,14 +18,14 @@
// limitations under the License.
//

#if os(iOS) || os(macOS)
#if canImport(LocalAuthentication)
Copy link
Collaborator

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?

return valet
CloudAccessibility.allValues().map { cloudAccessibility in
shared ? .iCloudSharedAccessGroupValet(with: identifier, accessibility: cloudAccessibility) : .iCloudValet(with: identifier, accessibility: cloudAccessibility)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no newline here

@dfed dfed merged commit 90d7a3b into develop--4.0 Dec 31, 2019
@dfed dfed deleted the dfed--swift-5 branch December 31, 2019 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants