Skip to content

Commit

Permalink
Update to iOS 17 and new Spezi version (#16)
Browse files Browse the repository at this point in the history
# Update to iOS 17 and new Spezi version

## ♻️ Current situation & Problem
This PR prepares SpeziStorage for the upcoming version of Spezi and
replaces ObservableObject with Observable.


## ⚙️ Release Notes 
* Update to iOS 17
* Compatibility with upcoming Spezi release
* **Breaking**: Replaces observable object with Observable.


## 📚 Documentation
Documentation was updated.


## ✅ Testing
Affected test code was updated.


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg committed Nov 8, 2023
1 parent d3db2a6 commit e9be3c2
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -13,3 +13,4 @@ SpeziStorage contributors

* [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
* [Vishnu Ravi](https://github.com/vishnuravi)
* [Andreas Bauer](https://github.com/Supereg)
6 changes: 3 additions & 3 deletions Package.swift
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9

//
// This source file is part of the Stanford Spezi open-source project
Expand All @@ -14,14 +14,14 @@ import PackageDescription
let package = Package(
name: "SpeziStorage",
platforms: [
.iOS(.v16)
.iOS(.v17)
],
products: [
.library(name: "SpeziLocalStorage", targets: ["SpeziLocalStorage"]),
.library(name: "SpeziSecureStorage", targets: ["SpeziSecureStorage"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/Spezi", .upToNextMinor(from: "0.7.0")),
.package(url: "https://github.com/StanfordSpezi/Spezi", .upToNextMinor(from: "0.8.0")),
.package(url: "https://github.com/StanfordBDHG/XCTRuntimeAssertions", .upToNextMinor(from: "0.2.5"))
],
targets: [
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -52,8 +52,8 @@ You can then use the [`LocalStorage`](https://swiftpackageindex.com/stanfordspez

```swift
struct ExampleStorageView: View {
@EnvironmentObject var secureStorage: LocalStorage
@EnvironmentObject var secureStorage: SecureStorage
@Environment(LocalStorage.self) var secureStorage
@Environment(SecureStorage.self) var secureStorage


var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SpeziLocalStorage/LocalStorage.swift
Expand Up @@ -18,7 +18,7 @@ import SpeziSecureStorage
/// Use ``LocalStorage/store(_:storageKey:settings:)`` to store elements on disk and define the settings using a ``LocalStorageSetting`` instance.
///
/// Use ``LocalStorage/read(_:storageKey:settings:)`` to read elements on disk which are decoded as define by passed in ``LocalStorageSetting`` instance.
public final class LocalStorage: Module, DefaultInitializable {
public final class LocalStorage: Module, DefaultInitializable, EnvironmentAccessible {
private let encryptionAlgorithm: SecKeyAlgorithm = .eciesEncryptionCofactorX963SHA256AESGCM
@Dependency private var secureStorage = SecureStorage()

Expand Down
Expand Up @@ -49,7 +49,7 @@ You can then use the ``LocalStorage`` class in any SwiftUI view.

```swift
struct ExampleStorageView: View {
@EnvironmentObject var localStorage: LocalStorage
@Environment(LocalStorage.self) var localStorage


var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SpeziSecureStorage/SecureStorage.swift
Expand Up @@ -17,7 +17,7 @@ import XCTRuntimeAssertions
/// The ``SecureStorage`` serves as a reusable `Module` that can be used to store small chunks of data such as credentials and keys.
///
/// The storing of credentials and keys follows the Keychain documentation provided by Apple: https://developer.apple.com/documentation/security/keychain_services/keychain_items/using_the_keychain_to_manage_user_secrets.
public final class SecureStorage: Module, DefaultInitializable {
public final class SecureStorage: Module, DefaultInitializable, EnvironmentAccessible {
/// The ``SecureStorage`` serves as a reusable `Module` that can be used to store store small chunks of data such as credentials and keys.
///
/// The storing of credentials and keys follows the Keychain documentation provided by Apple:
Expand Down
Expand Up @@ -49,7 +49,7 @@ You can then use the ``SecureStorage`` class in any SwiftUI view.

```swift
struct ExampleStorageView: View {
@EnvironmentObject var secureStorage: SecureStorage
@Environment(SecureStorage.self) var secureStorage


var body: some View {
Expand Down
Expand Up @@ -13,9 +13,9 @@ import XCTestApp


struct LocalStorageTestsView: View {
@EnvironmentObject var localStorage: LocalStorage
@EnvironmentObject var secureStorage: SecureStorage
@Environment(LocalStorage.self) var localStorage
@Environment(SecureStorage.self) var secureStorage


var body: some View {
TestAppView(testCase: LocalStorageTests(localStorage: localStorage, secureStorage: secureStorage))
Expand Down
Expand Up @@ -12,7 +12,7 @@ import XCTestApp


struct SecureStorageTestsView: View {
@EnvironmentObject var secureStorage: SecureStorage
@Environment(SecureStorage.self) var secureStorage


var body: some View {
Expand Down
6 changes: 3 additions & 3 deletions Tests/UITests/UITests.xcodeproj/project.pbxproj
Expand Up @@ -350,7 +350,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -404,7 +404,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -567,7 +567,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down

0 comments on commit e9be3c2

Please sign in to comment.