File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737/* Begin PBXFileReference section */
3838 39D1340F1CAC4B4E00EA2ECE /* AssetManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetManager.swift; sourceTree = "<group>"; };
3939 39E3C3301CAFD79200340DAD /* LocationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationManager.swift; sourceTree = "<group>"; };
40+ 77F15A38249EE45A00FDF417 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
4041 D20FF6351CD23426000F3BFE /* CameraMan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraMan.swift; sourceTree = "<group>"; };
4142 D25A8C2B1D47681E0008D2F7 /* ImageGalleryLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageGalleryLayout.swift; sourceTree = "<group>"; };
4243 D25A8C2D1D4768250008D2F7 /* Helper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Helper.swift; sourceTree = "<group>"; };
7576/* End PBXFrameworksBuildPhase section */
7677
7778/* Begin PBXGroup section */
79+ 77F15A35249EE2C500FDF417 /* RootFiles */ = {
80+ isa = PBXGroup;
81+ children = (
82+ 77F15A38249EE45A00FDF417 /* Package.swift */,
83+ );
84+ name = RootFiles;
85+ sourceTree = "<group>";
86+ };
7887 D5D370B91C44FD1600690C0A /* Images */ = {
7988 isa = PBXGroup;
8089 children = (
95104 D5D370B91C44FD1600690C0A /* Images */,
96105 D5DC59A81C201CC4003BD79B /* SupportFiles */,
97106 D5DC59AA1C201CC4003BD79B /* Source */,
107+ 77F15A35249EE2C500FDF417 /* RootFiles */,
98108 D5DC598C1C201BE1003BD79B /* Products */,
99109 );
100110 indentWidth = 2;
Original file line number Diff line number Diff line change 1+ // swift-tools-version:5.1
2+
3+ import PackageDescription
4+
5+ let package = Package (
6+ name: " ImagePicker " ,
7+ platforms: [
8+ . iOS( . v9)
9+ ] ,
10+ products: [
11+ // Products define the executables and libraries produced by a package, and make them visible to other packages.
12+ . library(
13+ name: " ImagePicker " ,
14+ targets: [ " ImagePicker " ] ) ,
15+ ] ,
16+ dependencies: [
17+ // Dependencies declare other packages that this package depends on.
18+ // .package(url: /* package url */, from: "1.0.0"),
19+ ] ,
20+ targets: [
21+ // Targets are the basic building blocks of a package. A target can define a module or a test suite.
22+ // Targets can depend on other targets in this package, and on products in packages which this package depends on.
23+ . target(
24+ name: " ImagePicker " ,
25+ dependencies: [ ] ,
26+ path: " Source " )
27+ ] ,
28+ swiftLanguageVersions: [ . v5]
29+ )
Original file line number Diff line number Diff line change @@ -2,13 +2,22 @@ import Foundation
22import UIKit
33import Photos
44
5+ extension Bundle {
6+ static func myResourceBundle( ) -> Bundle ? {
7+ let bundles = Bundle . allBundles
8+ let bundlePaths = bundles. compactMap { $0. resourceURL? . appendingPathComponent ( " ImagePicker " , isDirectory: false ) . appendingPathExtension ( " bundle " ) }
9+
10+ return bundlePaths. compactMap ( { Bundle ( url: $0) } ) . first
11+ }
12+ }
13+
514open class AssetManager {
615
716 public static func getImage( _ name: String ) -> UIImage {
817 let traitCollection = UITraitCollection ( displayScale: 3 )
9- var bundle = Bundle ( for : AssetManager . self )
18+ var bundle = Bundle . myResourceBundle ( )
1019
11- if let resource = bundle. resourcePath, let resourceBundle = Bundle ( path: resource + " /ImagePicker.bundle " ) {
20+ if let resource = bundle? . resourcePath, let resourceBundle = Bundle ( path: resource + " /ImagePicker.bundle " ) {
1221 bundle = resourceBundle
1322 }
1423
You can’t perform that action at this time.
0 commit comments