Skip to content

Commit c23fd76

Browse files
Add SwiftPM manifest and localized string lookup
1 parent f34bf7b commit c23fd76

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ playground.xcworkspace
3737
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
3838
# Packages/
3939
# Package.pins
40+
Package.resolved
4041
.build/
42+
.swiftpm/
4143

4244
# CocoaPods
4345
#

AssetsPickerViewController/Classes/Utility/String+AssetsPickerViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ extension String {
1515
let customConfig = AssetsPickerConfig.customStringConfig,
1616
let localizedKey = AssetsPickerLocalizedStringKey(rawValue: key),
1717
let string = customConfig[localizedKey] else {
18+
#if SWIFT_PACKAGE
19+
self = Bundle.module.localizedString(forKey: key, value: key, table: "AssetsPickerViewController")
20+
#else
1821
self = Bundle.assetsPickerBundle.localizedString(forKey: key, value: key, table: "AssetsPickerViewController")
22+
#endif
1923
return
2024
}
2125
self = string

Package.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "AssetsPickerViewController",
6+
defaultLocalization: "en",
7+
platforms: [.iOS(.v10)],
8+
products: [
9+
.library(
10+
name: "AssetsPickerViewController",
11+
targets: ["AssetsPickerViewController"]
12+
)
13+
],
14+
dependencies: [
15+
.package(url: "https://github.com/SnapKit/SnapKit", from: "5.0.1")
16+
],
17+
targets: [
18+
.target(
19+
name: "AssetsPickerViewController",
20+
dependencies: ["SnapKit"],
21+
path: "AssetsPickerViewController",
22+
sources: ["Classes"],
23+
resources: [.process("Assets")]
24+
)
25+
],
26+
swiftLanguageVersions: [.v4_2, .v5]
27+
)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ Customizable Album & Asset Layout
101101

102102
- multiple selection by dragging cells (from iOS 13)
103103

104+
- SPM(Swift Package Manager) support
104105

105-
## Features To-do
106106

107-
- SPM(Swift Package Manager) support
107+
## Features To-do
108108

109109
- Cropping image before select
110110

0 commit comments

Comments
 (0)