Skip to content

Commit 0be1a83

Browse files
committed
Merge release/v1.1.0 into master
2 parents a4796ca + 62a4f9b commit 0be1a83

File tree

3 files changed

+60
-13
lines changed

3 files changed

+60
-13
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<a href="https://github.com/Carthage/Carthage">
55
<img alt="Carthage Compatible" src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat">
66
</a>
7-
<a href="https://swift.org/blog/swift-5-1-released/">
8-
<img alt="Swift 5.0" src="http://img.shields.io/badge/swift-5.1-brightgreen.svg">
7+
<a href="https://swift.org/blog/swift-5-2-released/">
8+
<img alt="Swift 5.2" src="http://img.shields.io/badge/swift-5.2-brightgreen.svg">
99
</a>
1010
<a href="https://github.com/simonmitchell/ReviewKit/blob/master/README.md">
1111
<img alt="MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg">
@@ -32,7 +32,7 @@ Usage on other platforms is outlined [below](#other-platforms)
3232
[Carthage](https://github.com/Carthage/Carthage) is a package manager which either builds projects and provides you with binaries or uses pre-built frameworks from release tags in GitHub. To add ReviewKit to your project, simply specify it in your `Cartfile`:
3333

3434
```ogdl
35-
github "simonmitchell/ReviewKit" ~> 1.0.0
35+
github "simonmitchell/ReviewKit" ~> 1.1.0
3636
```
3737

3838
### Swift Package Manager
@@ -42,7 +42,7 @@ To add ReviewKit to your project simply add it to your dependencies array:
4242

4343
```swift
4444
dependencies: [
45-
.package(url: "https://github.com/simonmitchell/ReviewKit.git", .upToNextMajor(from: "1.0.0"))
45+
.package(url: "https://github.com/simonmitchell/ReviewKit.git", .upToNextMajor(from: "1.1.0"))
4646
]
4747
```
4848

@@ -60,7 +60,7 @@ Manual installation (as of iOS 13) requires a paid developer license in order to
6060
To start a new app session, simply call:
6161

6262
```swift
63-
RequestController.startSession(version: .init(major: 1, minor: 0, patch: 0))
63+
RequestController.startSession(version: Bundle.main.version)
6464
```
6565

6666
It is very important you call this before logging actions, otherwise they will be stored under a default session with app version `1.0.0`

ReviewKit.xcodeproj/project.pbxproj

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
B17E7C5A242E9F160020B053 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17E7C59242E9F160020B053 /* Bundle+Version.swift */; };
11+
B17E7C5B242E9F160020B053 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17E7C59242E9F160020B053 /* Bundle+Version.swift */; };
12+
B17E7C5C242E9F160020B053 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17E7C59242E9F160020B053 /* Bundle+Version.swift */; };
13+
B17E7C5D242E9F160020B053 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17E7C59242E9F160020B053 /* Bundle+Version.swift */; };
1014
B197DB102423962200D3DBCF /* ReviewKit_watchOS.h in Headers */ = {isa = PBXBuildFile; fileRef = B197DB0E2423962200D3DBCF /* ReviewKit_watchOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
1115
B197DB1D2423963100D3DBCF /* ReviewKit_tvOS.h in Headers */ = {isa = PBXBuildFile; fileRef = B197DB1B2423963100D3DBCF /* ReviewKit_tvOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
1216
B197DB2A2423963D00D3DBCF /* ReviewKit_macOS.h in Headers */ = {isa = PBXBuildFile; fileRef = B197DB282423963D00D3DBCF /* ReviewKit_macOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -45,6 +49,7 @@
4549
/* End PBXBuildFile section */
4650

4751
/* Begin PBXFileReference section */
52+
B17E7C59242E9F160020B053 /* Bundle+Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Bundle+Version.swift"; path = "Sources/ReviewKit/Bundle+Version.swift"; sourceTree = "<group>"; };
4853
B197DAFF242395B300D3DBCF /* ReviewKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReviewKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4954
B197DB0C2423962200D3DBCF /* ReviewKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReviewKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5055
B197DB0E2423962200D3DBCF /* ReviewKit_watchOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReviewKit_watchOS.h; sourceTree = "<group>"; };
@@ -155,6 +160,7 @@
155160
isa = PBXGroup;
156161
children = (
157162
B197DB342423974C00D3DBCF /* AppStoreReviewRequester.swift */,
163+
B17E7C59242E9F160020B053 /* Bundle+Version.swift */,
158164
B197DB302423974C00D3DBCF /* ClosedRange+Clamp.swift */,
159165
B197DB2E2423974C00D3DBCF /* Collection+Average.swift */,
160166
B197DB312423974C00D3DBCF /* ReviewRequestController.swift */,
@@ -365,6 +371,7 @@
365371
B197DB3E2423974C00D3DBCF /* ClosedRange+Clamp.swift in Sources */,
366372
B197DB522423974C00D3DBCF /* UserDefaults+ReviewRequestControllerStorage.swift in Sources */,
367373
B197DB4A2423974C00D3DBCF /* ReviewRequester.swift in Sources */,
374+
B17E7C5A242E9F160020B053 /* Bundle+Version.swift in Sources */,
368375
B197DB462423974C00D3DBCF /* Version+Number.swift in Sources */,
369376
B197DB3A2423974C00D3DBCF /* ReviewRequestControllerStorage.swift in Sources */,
370377
B197DB422423974C00D3DBCF /* ReviewRequestController.swift in Sources */,
@@ -380,6 +387,7 @@
380387
B197DB3F2423974C00D3DBCF /* ClosedRange+Clamp.swift in Sources */,
381388
B197DB532423974C00D3DBCF /* UserDefaults+ReviewRequestControllerStorage.swift in Sources */,
382389
B197DB4B2423974C00D3DBCF /* ReviewRequester.swift in Sources */,
390+
B17E7C5B242E9F160020B053 /* Bundle+Version.swift in Sources */,
383391
B197DB472423974C00D3DBCF /* Version+Number.swift in Sources */,
384392
B197DB3B2423974C00D3DBCF /* ReviewRequestControllerStorage.swift in Sources */,
385393
B197DB432423974C00D3DBCF /* ReviewRequestController.swift in Sources */,
@@ -395,6 +403,7 @@
395403
B197DB402423974C00D3DBCF /* ClosedRange+Clamp.swift in Sources */,
396404
B197DB542423974C00D3DBCF /* UserDefaults+ReviewRequestControllerStorage.swift in Sources */,
397405
B197DB4C2423974C00D3DBCF /* ReviewRequester.swift in Sources */,
406+
B17E7C5C242E9F160020B053 /* Bundle+Version.swift in Sources */,
398407
B197DB482423974C00D3DBCF /* Version+Number.swift in Sources */,
399408
B197DB3C2423974C00D3DBCF /* ReviewRequestControllerStorage.swift in Sources */,
400409
B197DB442423974C00D3DBCF /* ReviewRequestController.swift in Sources */,
@@ -410,6 +419,7 @@
410419
B197DB412423974C00D3DBCF /* ClosedRange+Clamp.swift in Sources */,
411420
B197DB552423974C00D3DBCF /* UserDefaults+ReviewRequestControllerStorage.swift in Sources */,
412421
B197DB4D2423974C00D3DBCF /* ReviewRequester.swift in Sources */,
422+
B17E7C5D242E9F160020B053 /* Bundle+Version.swift in Sources */,
413423
B197DB492423974C00D3DBCF /* Version+Number.swift in Sources */,
414424
B197DB3D2423974C00D3DBCF /* ReviewRequestControllerStorage.swift in Sources */,
415425
B197DB452423974C00D3DBCF /* ReviewRequestController.swift in Sources */,
@@ -439,7 +449,7 @@
439449
"@executable_path/Frameworks",
440450
"@loader_path/Frameworks",
441451
);
442-
MARKETING_VERSION = 1.0.1;
452+
MARKETING_VERSION = 1.1.0;
443453
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-iOS";
444454
PRODUCT_NAME = ReviewKit;
445455
SKIP_INSTALL = YES;
@@ -468,7 +478,7 @@
468478
"@executable_path/Frameworks",
469479
"@loader_path/Frameworks",
470480
);
471-
MARKETING_VERSION = 1.0.1;
481+
MARKETING_VERSION = 1.1.0;
472482
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-iOS";
473483
PRODUCT_NAME = ReviewKit;
474484
SKIP_INSTALL = YES;
@@ -496,7 +506,7 @@
496506
"@executable_path/Frameworks",
497507
"@loader_path/Frameworks",
498508
);
499-
MARKETING_VERSION = 1.0.1;
509+
MARKETING_VERSION = 1.1.0;
500510
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-watchOS";
501511
PRODUCT_NAME = ReviewKit;
502512
SDKROOT = watchos;
@@ -527,7 +537,7 @@
527537
"@executable_path/Frameworks",
528538
"@loader_path/Frameworks",
529539
);
530-
MARKETING_VERSION = 1.0.1;
540+
MARKETING_VERSION = 1.1.0;
531541
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-watchOS";
532542
PRODUCT_NAME = ReviewKit;
533543
SDKROOT = watchos;
@@ -556,7 +566,7 @@
556566
"@executable_path/Frameworks",
557567
"@loader_path/Frameworks",
558568
);
559-
MARKETING_VERSION = 1.0.1;
569+
MARKETING_VERSION = 1.1.0;
560570
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-tvOS";
561571
PRODUCT_NAME = ReviewKit;
562572
SDKROOT = appletvos;
@@ -586,7 +596,7 @@
586596
"@executable_path/Frameworks",
587597
"@loader_path/Frameworks",
588598
);
589-
MARKETING_VERSION = 1.0.1;
599+
MARKETING_VERSION = 1.1.0;
590600
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-tvOS";
591601
PRODUCT_NAME = ReviewKit;
592602
SDKROOT = appletvos;
@@ -617,7 +627,7 @@
617627
"@loader_path/Frameworks",
618628
);
619629
MACOSX_DEPLOYMENT_TARGET = 10.9;
620-
MARKETING_VERSION = 1.0.1;
630+
MARKETING_VERSION = 1.1.0;
621631
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-macOS";
622632
PRODUCT_NAME = ReviewKit;
623633
SDKROOT = macosx;
@@ -647,7 +657,7 @@
647657
"@loader_path/Frameworks",
648658
);
649659
MACOSX_DEPLOYMENT_TARGET = 10.9;
650-
MARKETING_VERSION = 1.0.1;
660+
MARKETING_VERSION = 1.1.0;
651661
PRODUCT_BUNDLE_IDENTIFIER = "com.yellowbrickbear.ReviewKit-macOS";
652662
PRODUCT_NAME = ReviewKit;
653663
SDKROOT = macosx;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// Bundle+Version.swift
3+
//
4+
//
5+
// Created by Simon Mitchell on 27/03/2020.
6+
//
7+
8+
#if canImport(Foundation)
9+
import Foundation
10+
11+
public extension Bundle {
12+
13+
/// Returns the `CFBundleShortVersionString` value from the bundle as a version struct
14+
var version: ReviewRequestController.Version {
15+
16+
// This can never NOT be present, so we won't force unwrap, but we will throw a fatal error if it is missing for some reason
17+
guard let versionString = infoDictionary?["CFBundleShortVersionString"] as? String else {
18+
fatalError("You cannot access Bundle().version if CFBundleShortVersionString is not present, please use a manually constructed version instead.")
19+
}
20+
21+
let components = versionString.components(separatedBy: ".")
22+
23+
// Apple requires `CFBundleShortVersionString` to be a set of integers separated by '.' so we can `fatalError` if the user hasn't done this!
24+
guard let firstComponent = components.first, let major = UInt(firstComponent) else {
25+
fatalError("CFBundleVersionString must be a string consisting of integers separated by a . otherwise Apple will reject your app.")
26+
}
27+
28+
// If have only provided `major` part of version, fallback to `0`
29+
let minor: UInt = components.count > 1 ? UInt(components[1]) ?? 0 : 0
30+
// If haven't provided `patch` part of version string, fallback to `0`
31+
let patch: UInt = components.count > 2 ? UInt(components[2]) ?? 0 : 0
32+
33+
return ReviewRequestController.Version(major: major, minor: minor, patch: patch)
34+
}
35+
}
36+
37+
#endif

0 commit comments

Comments
 (0)