Skip to content

Commit 4ed5094

Browse files
author
Luc Dion
authored
Merge pull request #38 from mirego/add_swift_package_manager_support
Add swift package manager support
2 parents dd3fbdb + 61d6ded commit 4ed5094

File tree

8 files changed

+44
-16
lines changed

8 files changed

+44
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Xcode
22
#
33

4+
.build/
45
build/
56
DerivedData/
67
Pods/

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// swift-tools-version:3.1
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "PinLayout"
7+
)

PinLayout.xcodeproj/project.pbxproj

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
249EFE841E64FB4C00165E39 /* PinLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 249EFE7A1E64FB4C00165E39 /* PinLayout.framework */; };
2323
249EFE891E64FB4C00165E39 /* PinLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249EFE881E64FB4C00165E39 /* PinLayoutTests.swift */; };
2424
249EFE8B1E64FB4C00165E39 /* PinLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 249EFE7D1E64FB4C00165E39 /* PinLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
25+
24E301DC1EE813280064EE8D /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E301DB1EE813280064EE8D /* Coordinates.swift */; };
2526
DF11A3711E833F03008B33E5 /* TypesImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF11A3701E833F03008B33E5 /* TypesImpl.swift */; };
26-
DF11A37A1E834B3F008B33E5 /* Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF11A3791E834B3F008B33E5 /* Coordinates.swift */; };
2727
DF7A36BD1E918301000F9856 /* PinEdgesSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF7A36BC1E918301000F9856 /* PinEdgesSpec.swift */; };
2828
DFC97CA51E8A8EB3001545D5 /* PinLayoutImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFC97CA41E8A8EB3001545D5 /* PinLayoutImpl.swift */; };
2929
DFC97CA71E8A8F2C001545D5 /* PinLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFC97CA61E8A8F2C001545D5 /* PinLayout.swift */; };
@@ -70,8 +70,8 @@
7070
249EFE831E64FB4C00165E39 /* PinLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PinLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7171
249EFE881E64FB4C00165E39 /* PinLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutTests.swift; sourceTree = "<group>"; };
7272
249EFE8A1E64FB4C00165E39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
73+
24E301DB1EE813280064EE8D /* Coordinates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Coordinates.swift; sourceTree = "<group>"; };
7374
DF11A3701E833F03008B33E5 /* TypesImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypesImpl.swift; sourceTree = "<group>"; };
74-
DF11A3791E834B3F008B33E5 /* Coordinates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Coordinates.swift; sourceTree = "<group>"; };
7575
DF7A36BC1E918301000F9856 /* PinEdgesSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinEdgesSpec.swift; sourceTree = "<group>"; };
7676
DFC97CA41E8A8EB3001545D5 /* PinLayoutImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinLayoutImpl.swift; sourceTree = "<group>"; };
7777
DFC97CA61E8A8F2C001545D5 /* PinLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinLayout.swift; sourceTree = "<group>"; };
@@ -110,7 +110,7 @@
110110
249EFE701E64FB4C00165E39 = {
111111
isa = PBXGroup;
112112
children = (
113-
249EFE7C1E64FB4C00165E39 /* PinLayout */,
113+
249EFE7C1E64FB4C00165E39 /* Sources */,
114114
249EFE871E64FB4C00165E39 /* PinLayoutTests */,
115115
249EFE7B1E64FB4C00165E39 /* Products */,
116116
DF11A3741E834181008B33E5 /* Supporting Files */,
@@ -127,14 +127,13 @@
127127
name = Products;
128128
sourceTree = "<group>";
129129
};
130-
249EFE7C1E64FB4C00165E39 /* PinLayout */ = {
130+
249EFE7C1E64FB4C00165E39 /* Sources */ = {
131131
isa = PBXGroup;
132132
children = (
133133
DFC97CA61E8A8F2C001545D5 /* PinLayout.swift */,
134134
DFA06B031E8B38B300B6D5E7 /* Impl */,
135-
DF11A3761E8341A2008B33E5 /* Helpers */,
136135
);
137-
path = PinLayout;
136+
path = Sources;
138137
sourceTree = "<group>";
139138
};
140139
249EFE871E64FB4C00165E39 /* PinLayoutTests */ = {
@@ -164,19 +163,12 @@
164163
path = "Supporting Files";
165164
sourceTree = "<group>";
166165
};
167-
DF11A3761E8341A2008B33E5 /* Helpers */ = {
168-
isa = PBXGroup;
169-
children = (
170-
DF11A3791E834B3F008B33E5 /* Coordinates.swift */,
171-
);
172-
path = Helpers;
173-
sourceTree = "<group>";
174-
};
175166
DFA06B031E8B38B300B6D5E7 /* Impl */ = {
176167
isa = PBXGroup;
177168
children = (
178169
DFC97CA41E8A8EB3001545D5 /* PinLayoutImpl.swift */,
179170
DF11A3701E833F03008B33E5 /* TypesImpl.swift */,
171+
24E301DB1EE813280064EE8D /* Coordinates.swift */,
180172
);
181173
name = Impl;
182174
sourceTree = "<group>";
@@ -314,9 +306,9 @@
314306
buildActionMask = 2147483647;
315307
files = (
316308
DF11A3711E833F03008B33E5 /* TypesImpl.swift in Sources */,
317-
DF11A37A1E834B3F008B33E5 /* Coordinates.swift in Sources */,
318309
DFC97CA71E8A8F2C001545D5 /* PinLayout.swift in Sources */,
319310
DFC97CA51E8A8EB3001545D5 /* PinLayoutImpl.swift in Sources */,
311+
24E301DC1EE813280064EE8D /* Coordinates.swift in Sources */,
320312
);
321313
runOnlyForDeploymentPostprocessing = 0;
322314
};

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ github "mirego/PinLayout"
9393

9494
Then, run `carthage update` to build the framework and drag the built `PinLayout.framework` into your Xcode project.
9595

96+
### Swift Package Manager
97+
98+
Once you have your Swift package set up, you only need to add PinLayout as a dependency of your `Package.swift`.
99+
100+
```ogdl
101+
dependencies: [
102+
.Package(url: "https://github.com/mirego/PinLayout.git", majorVersion: 1)
103+
]
104+
```
105+
96106
<br>
97107

98108
# Usage sample
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2626
// POSSIBILITY OF SUCH DAMAGE.
2727

28+
import Foundation
29+
30+
#if os(iOS)
2831
import UIKit
2932

3033
class Coordinates {
@@ -93,3 +96,5 @@ class Coordinates {
9396
public func setUnitTest(displayScale: CGFloat) {
9497
Coordinates.displayScale = displayScale
9598
}
99+
100+
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2626
// POSSIBILITY OF SUCH DAMAGE.
2727

28+
import Foundation
29+
30+
#if os(iOS)
2831
import UIKit
2932

3033
// MARK: - PinLayout UIView's extension
@@ -306,3 +309,5 @@ prefix operator -
306309
public prefix func - (p: Percent) -> Percent {
307310
return Percent(value: -p.value)
308311
}
312+
313+
#endif
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2525
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2626
// POSSIBILITY OF SUCH DAMAGE.
27-
import UIKit
2827

28+
import Foundation
29+
30+
#if os(iOS)
31+
2932
public var unitTestLastWarning: String?
3033

3134
#if DEBUG
@@ -1195,3 +1198,4 @@ extension PinLayoutImpl {
11951198
}
11961199
}
11971200

1201+
#endif
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2626
// POSSIBILITY OF SUCH DAMAGE.
2727

28+
import Foundation
29+
30+
#if os(iOS)
2831
import UIKit
2932

3033
typealias Context = () -> String
@@ -151,3 +154,4 @@ extension Percent: CustomStringConvertible {
151154
}
152155
}
153156

157+
#endif

0 commit comments

Comments
 (0)