From ff01b6db676156bd062b633bff9e6a6230f4fe34 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Thu, 2 May 2024 17:03:56 -0500 Subject: [PATCH 1/3] Convert shared_preferences_foundation into a Swift Package --- .../shared_preferences_foundation.podspec | 4 +-- .../Package.swift | 28 +++++++++++++++++++ .../Resources/PrivacyInfo.xcprivacy | 0 .../SharedPreferencesPlugin.swift | 0 .../messages.g.swift | 0 .../ios/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../example/ios/Runner/AppDelegate.swift | 2 +- .../macos/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../example/macos/Runner/AppDelegate.swift | 2 +- .../pigeons/messages.dart | 2 +- 12 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Package.swift rename packages/shared_preferences/shared_preferences_foundation/darwin/{ => shared_preferences_foundation/Sources/shared_preferences_foundation}/Resources/PrivacyInfo.xcprivacy (100%) rename packages/shared_preferences/shared_preferences_foundation/darwin/{Classes => shared_preferences_foundation/Sources/shared_preferences_foundation}/SharedPreferencesPlugin.swift (100%) rename packages/shared_preferences/shared_preferences_foundation/darwin/{Classes => shared_preferences_foundation/Sources/shared_preferences_foundation}/messages.g.swift (100%) diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation.podspec b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation.podspec index 41ec1683c17f..008f51f30f41 100644 --- a/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation.podspec +++ b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation.podspec @@ -12,7 +12,7 @@ Wraps NSUserDefaults, providing a persistent store for simple key-value pairs. s.license = { :type => 'BSD', :file => '../LICENSE' } s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_foundation' } - s.source_files = 'Classes/**/*' + s.source_files = 'shared_preferences_foundation/Sources/shared_preferences_foundation/**/*.swift' s.ios.dependency 'Flutter' s.osx.dependency 'FlutterMacOS' s.ios.deployment_target = '12.0' @@ -23,6 +23,6 @@ Wraps NSUserDefaults, providing a persistent store for simple key-value pairs. 'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift', } s.swift_version = '5.0' - s.resource_bundles = {'shared_preferences_foundation_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + s.resource_bundles = {'shared_preferences_foundation_privacy' => ['shared_preferences_foundation/Sources/shared_preferences_foundation/Resources/PrivacyInfo.xcprivacy']} end diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Package.swift b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Package.swift new file mode 100644 index 000000000000..eae02a420e82 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version: 5.9 + +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import PackageDescription + +let package = Package( + name: "shared_preferences_foundation", + platforms: [ + .iOS("12.0"), + .macOS("10.14"), + ], + products: [ + .library(name: "shared-preferences-foundation", targets: ["shared_preferences_foundation"]) + ], + dependencies: [], + targets: [ + .target( + name: "shared_preferences_foundation", + dependencies: [], + resources: [ + .process("Resources") + ] + ) + ] +) diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/Resources/PrivacyInfo.xcprivacy b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/Resources/PrivacyInfo.xcprivacy similarity index 100% rename from packages/shared_preferences/shared_preferences_foundation/darwin/Resources/PrivacyInfo.xcprivacy rename to packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/Resources/PrivacyInfo.xcprivacy diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/SharedPreferencesPlugin.swift similarity index 100% rename from packages/shared_preferences/shared_preferences_foundation/darwin/Classes/SharedPreferencesPlugin.swift rename to packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/SharedPreferencesPlugin.swift diff --git a/packages/shared_preferences/shared_preferences_foundation/darwin/Classes/messages.g.swift b/packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift similarity index 100% rename from packages/shared_preferences/shared_preferences_foundation/darwin/Classes/messages.g.swift rename to packages/shared_preferences/shared_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift diff --git a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/project.pbxproj index 4f0d99270a26..a2ad88eea841 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -215,7 +215,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { diff --git a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 87131a09bea5..8e3ca5dfe193 100644 --- a/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/shared_preferences/shared_preferences_foundation/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ Bool { return true diff --git a/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart b/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart index 46deeef2bdf1..a4c8bc5ff2f0 100644 --- a/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart +++ b/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart @@ -7,7 +7,7 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon(PigeonOptions( dartOut: 'lib/messages.g.dart', dartTestOut: 'test/test_api.g.dart', - swiftOut: 'darwin/Classes/messages.g.swift', + swiftOut: 'darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift', copyrightHeader: 'pigeons/copyright_header.txt', )) @HostApi(dartHostTestHandler: 'TestUserDefaultsApi') From 222cb9450fe37463e8a0ff6ecadf014d663be2c2 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Thu, 2 May 2024 17:04:30 -0500 Subject: [PATCH 2/3] Update changelog and version --- .../shared_preferences_foundation/CHANGELOG.md | 3 ++- .../shared_preferences_foundation/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md b/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md index 317d893cd375..c1761f548223 100644 --- a/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.3.6 +* Adds Swift Package Manager compatibility. * Updates minimum iOS version to 12.0 and minimum Flutter version to 3.16.6. ## 2.3.5 diff --git a/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml b/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml index c94bdae980c7..44400b3553e2 100644 --- a/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml @@ -2,7 +2,7 @@ name: shared_preferences_foundation description: iOS and macOS implementation of the shared_preferences plugin. repository: https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_foundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22 -version: 2.3.5 +version: 2.3.6 environment: sdk: ^3.2.3 From b7773732feaec976099c78c24e164f11fde70af3 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Mon, 6 May 2024 11:22:31 -0500 Subject: [PATCH 3/3] Fix format and change version to minor upgrade --- .../shared_preferences_foundation/CHANGELOG.md | 2 +- .../shared_preferences_foundation/pigeons/messages.dart | 3 ++- .../shared_preferences_foundation/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md b/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md index c1761f548223..e487278c4986 100644 --- a/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md +++ b/packages/shared_preferences/shared_preferences_foundation/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.3.6 +## 2.4.0 * Adds Swift Package Manager compatibility. * Updates minimum iOS version to 12.0 and minimum Flutter version to 3.16.6. diff --git a/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart b/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart index a4c8bc5ff2f0..ad8060e34741 100644 --- a/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart +++ b/packages/shared_preferences/shared_preferences_foundation/pigeons/messages.dart @@ -7,7 +7,8 @@ import 'package:pigeon/pigeon.dart'; @ConfigurePigeon(PigeonOptions( dartOut: 'lib/messages.g.dart', dartTestOut: 'test/test_api.g.dart', - swiftOut: 'darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift', + swiftOut: + 'darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift', copyrightHeader: 'pigeons/copyright_header.txt', )) @HostApi(dartHostTestHandler: 'TestUserDefaultsApi') diff --git a/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml b/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml index 44400b3553e2..2e5d728e1422 100644 --- a/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_foundation/pubspec.yaml @@ -2,7 +2,7 @@ name: shared_preferences_foundation description: iOS and macOS implementation of the shared_preferences plugin. repository: https://github.com/flutter/packages/tree/main/packages/shared_preferences/shared_preferences_foundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22 -version: 2.3.6 +version: 2.4.0 environment: sdk: ^3.2.3