Skip to content

Commit 627b7f5

Browse files
authored
Merge pull request #29 from prolificinteractive/feature/swift3
[Feature] Swift3
2 parents 3c8eb7f + 024bc56 commit 627b7f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+810
-931
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3
1+
3.0

Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ post_install do |installer|
2929
if config.name == "Debug"
3030
# Enables unit testing of pods frameworks
3131
config.build_settings['ENABLE_TESTABILITY'] = "YES"
32-
config.build_settings['SWIFT_VERSION'] = "2.3"
3332
end
3433
end
3534
end

Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ PODS:
55
- mParticle-Apple-SDK (6.11.1):
66
- mParticle-Apple-SDK/mParticle (= 6.11.1)
77
- mParticle-Apple-SDK/mParticle (6.11.1)
8-
- Simcoe/Adobe (0.4.0):
8+
- Simcoe/Adobe (0.5.1):
99
- AdobeMobileSDK (~> 4.13)
1010
- Simcoe/Core
11-
- Simcoe/Core (0.4.0)
12-
- Simcoe/mParticle (0.4.0):
11+
- Simcoe/Core (0.5.1)
12+
- Simcoe/mParticle (0.5.1):
1313
- mParticle-Apple-SDK (~> 6)
1414
- Simcoe/Core
1515

@@ -26,8 +26,8 @@ EXTERNAL SOURCES:
2626
SPEC CHECKSUMS:
2727
AdobeMobileSDK: 52c3fbf43b5b054132393b1486ecbefca0ba01db
2828
mParticle-Apple-SDK: 8c7dfc195459870aa33be634f006342cb37d6a24
29-
Simcoe: 1797e557b41c062ce9c044e52c8dd213bdb269a9
29+
Simcoe: 11fe674388e2f4c5b3f90090f165f5150b8aabb8
3030

31-
PODFILE CHECKSUM: ff6f7dfab7642eeaa4022fde98af95982fd9d182
31+
PODFILE CHECKSUM: eca652a10d5483dbc0b33408738dd00362f29b2c
3232

3333
COCOAPODS: 1.1.1

README.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ provider changes, simply update your `run()` call with the providers and that's
7070

7171
To facilitate debugging when using multiple providers, Simcoe contains a few options for updating the information logged in the console:
7272

73-
* Verbose
74-
* Simple
75-
* None
73+
* verbose
74+
* simple
75+
* none
7676

77-
By default, Simcoe will log all console outputs in detail (*Verbose*) providing one line per item for **each** provider that was specified. *Simple* will output one line per item regardless of how many providers were specified while *None* will disable all console logging. To update the *outputOption,* simply call (update this property after the `run()` command):
77+
By default, Simcoe will log all console outputs in detail (*verbose*) providing one line per item for **each** provider that was specified. *simple* will output one line per item regardless of how many providers were specified while *none* will disable all console logging. To update the *outputOption,* simply call (update this property after the `run()` command):
7878

79-
`Simcoe.engine.tracker.outputOption = .Simple`
79+
`Simcoe.engine.tracker.outputOption = .simple`
8080

8181
Simcoe providers a base function call for each major analytics action right out of the gate, giving a consistent API to all of your analytics tracking. For instance, to track page views:
8282

8383
``
84-
Simcoe.trackPageView("Home Screen")
84+
Simcoe.track(pageView: "Home Screen")
8585
``
8686

8787
That's it! Simcoe will automatically call all of your analytics providers and request that they log that page view. This same method is uniform and consistent, no matter what providers you are using.
@@ -110,19 +110,6 @@ While simply implementing this protocol is all you need for your object to be a
110110

111111
So for your analytics provider to be able to handle page views in the Simcoe framework, your provider should implement the `PageViewTracking` protocol. This plug-and-play API allows you to define what you want your provider to handle at a very granular level. If your provider only needs to implement location tracking and nothing else, then you need only implement the `LocationTracking` protocol (as well as the `AnalyticsTracking` protocol, of course); all other protocols are optional. This allows you full customization as to how your objects respond to Simcoe.
112112

113-
Each provider type defined above maps directly to a Simcoe function that will call that method. These are, respectively:
114-
115-
* `logAddToCart`, `logRemoveFromCart`
116-
* `trackCheckoutEvent`
117-
* `logError`
118-
* `trackEvent`
119-
* `increaseLifetimeValue`
120-
* `trackLocation`
121-
* `trackPageView`
122-
* `trackPurchaseEvent`
123-
* `setUserAttribute`
124-
* `logViewDetail`
125-
126113
#### Additional Tracking
127114

128115
Each analytics implementation is different, and Simcoe doesn't expect to be the be-all, end-all of analytics implementations. What if you need to track something that is not included in the base SDK?

Simcoe.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
606606
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeTests;
607607
PRODUCT_NAME = "$(TARGET_NAME)";
608-
SWIFT_VERSION = 2.3;
608+
SWIFT_VERSION = 3.0;
609609
};
610610
name = Debug;
611611
};
@@ -617,7 +617,7 @@
617617
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
618618
PRODUCT_BUNDLE_IDENTIFIER = com.prolificinteractive.SimcoeTests;
619619
PRODUCT_NAME = "$(TARGET_NAME)";
620-
SWIFT_VERSION = 2.3;
620+
SWIFT_VERSION = 3.0;
621621
};
622622
name = Release;
623623
};
@@ -666,6 +666,7 @@
666666
ONLY_ACTIVE_ARCH = YES;
667667
SDKROOT = iphoneos;
668668
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
669+
SWIFT_VERSION = 3.0;
669670
TARGETED_DEVICE_FAMILY = "1,2";
670671
VERSIONING_SYSTEM = "apple-generic";
671672
VERSION_INFO_PREFIX = "";
@@ -710,6 +711,7 @@
710711
MTL_ENABLE_DEBUG_INFO = NO;
711712
SDKROOT = iphoneos;
712713
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
714+
SWIFT_VERSION = 3.0;
713715
TARGETED_DEVICE_FAMILY = "1,2";
714716
VALIDATE_PRODUCT = YES;
715717
VERSIONING_SYSTEM = "apple-generic";
@@ -737,7 +739,7 @@
737739
SKIP_INSTALL = YES;
738740
SWIFT_OBJC_BRIDGING_HEADER = "";
739741
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
740-
SWIFT_VERSION = 2.3;
742+
SWIFT_VERSION = 3.0;
741743
};
742744
name = Debug;
743745
};
@@ -760,7 +762,7 @@
760762
PRODUCT_NAME = Simcoe;
761763
SKIP_INSTALL = YES;
762764
SWIFT_OBJC_BRIDGING_HEADER = "";
763-
SWIFT_VERSION = 2.3;
765+
SWIFT_VERSION = 3.0;
764766
};
765767
name = Release;
766768
};

Simcoe/Adobe/Adobe.swift

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import CoreLocation
1313
public class Adobe {
1414

1515
/// The name of the tracker.
16-
public let name = "Adobe Omniture"
16+
open let name = "Adobe Omniture"
1717

1818
/// The default initializer.
1919
public init() { }
2020

2121
/// Starts tracking analytics.
22-
public func start() {
22+
open func start() {
2323
ADBMobile.collectLifecycleData()
2424
}
2525

@@ -35,34 +35,33 @@ extension Adobe: EventTracking {
3535
/// - event: The event to track.
3636
/// - properties: The optional additional properties.
3737
/// - Returns: A tracking result.
38-
public func trackEvent(event: String, withAdditionalProperties properties: Properties?) -> TrackingResult {
38+
public func track(event: String,
39+
withAdditionalProperties properties: Properties?) -> TrackingResult {
3940
ADBMobile.trackAction(event, data: properties)
40-
return .Success
41+
return .success
4142
}
42-
43+
4344
}
4445

4546
// MARK: - LifetimeValueIncreasing
4647

4748
extension Adobe: LifetimeValueIncreasing {
4849

49-
/**
50-
Increases the lifetime value of the key by the specified amount.
51-
52-
- parameter amount: The amount to increase that lifetime value for.
53-
- parameter item: The optional item to extend.
54-
- parameter properties: The optional additional properties.
55-
56-
- returns: A tracking result.
57-
*/
50+
/// Increases the lifetime value of the key by the specified amount.
51+
///
52+
/// - Parameters:
53+
/// - amount: The amount to increase that lifetime value for.
54+
/// - item: The optional item to extend.
55+
/// - properties: The optional additional properties.
56+
/// - Returns: A tracking result.
5857
public func increaseLifetimeValue(byAmount amount: Double, forItem item: String?, withAdditionalProperties properties: Properties?) -> TrackingResult {
59-
var data = properties ?? [String: AnyObject]()
58+
var data = properties ?? Properties()
6059
if let item = item {
6160
data[item] = ""
6261
}
6362

64-
ADBMobile.trackLifetimeValueIncrease(NSDecimalNumber(double: 1), data: data)
65-
return .Success
63+
ADBMobile.trackLifetimeValueIncrease(NSDecimalNumber(value: amount), data: data)
64+
return .success
6665
}
6766

6867
}
@@ -71,36 +70,33 @@ extension Adobe: LifetimeValueIncreasing {
7170

7271
extension Adobe: LocationTracking {
7372

74-
/**
75-
Tracks location.
76-
77-
- parameter location: The location to track.
78-
- parameter properties: The optional additional properties.
79-
80-
- returns: A tracking result.
81-
*/
82-
public func trackLocation(location: CLLocation,
83-
withAdditionalProperties properties: [String: AnyObject]?) -> TrackingResult {
73+
/// Tracks location.
74+
///
75+
/// - Parameters:
76+
/// - location: The location to track.
77+
/// - properties: The optional additional properties.
78+
/// - Returns: A tracking result.
79+
public func track(location: CLLocation,
80+
withAdditionalProperties properties: Properties?) -> TrackingResult {
8481
ADBMobile.trackLocation(location, data: properties)
85-
return .Success
82+
return .success
8683
}
87-
84+
8885
}
8986

9087
// MARK: - PageViewTracking
9188

9289
extension Adobe: PageViewTracking {
9390

94-
/**
95-
Tracks the page view.
96-
97-
- parameter pageView: The page view to track.
98-
99-
- returns: A tracking result.
100-
*/
101-
public func trackPageView(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult {
91+
/// Tracks the page view.
92+
///
93+
/// - Parameters:
94+
/// - pageView: The page view to track.
95+
/// - properties: The optional additional properties.
96+
/// - Returns: A tracking result.
97+
public func track(pageView: String, withAdditionalProperties properties: Properties?) -> TrackingResult {
10298
ADBMobile.trackState(pageView, data: properties)
103-
return .Success
99+
return .success
104100
}
105101

106102
}

Simcoe/Analytics Tracking Protocols/AnalyticsTracking.swift

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
// Copyright © 2016 Prolific Interactive. All rights reserved.
77
//
88

9-
/**
10-
Default protocol for an object being trackable for analytics. All analytics items that wish to
11-
be tracked must, at least, implement this protocol.
12-
*/
9+
/// Default protocol for an object being trackable for analytics. All analytics items that wish to
10+
/// be tracked must, at least, implement this protocol.
1311
public protocol AnalyticsTracking {
1412

1513
/// The name of the tracker. This is used for debugging purposes only, but should
@@ -18,26 +16,23 @@ public protocol AnalyticsTracking {
1816
/// return "Adobe Omniture".
1917
var name: String { get }
2018

21-
/**
22-
Starts tracking analytics. This is called on all providers passed to `Simcoe.run`.
23-
Your analytics tracker should start tracking lifecycle data or setup anything else
24-
that needs to run for the duration of the analytics lifecycle.
2519

26-
This is an optional value and is implemented by default in an extension to do nothing.
27-
*/
20+
/// Starts tracking analytics. This is called on all providers passed to `Simcoe.run`.
21+
/// Your analytics tracker should start tracking lifecycle data or setup anything else
22+
/// that needs to run for the duration of the analytics lifecycle.
23+
///
24+
/// This is an optional value and is implemented by default in an extension to do nothing.
2825
func start()
2926

3027
}
3128

3229
public extension AnalyticsTracking {
3330

34-
/**
35-
Starts tracking analytics. This is called on all providers passed to `Simcoe.run`.
36-
Your analytics tracker should start tracking lifecycle data or setup anything else
37-
that needs to run for the duration of the analytics lifecycle.
38-
39-
This is an optional value and is implemented by default in an extension to do nothing.
40-
*/
31+
/// Starts tracking analytics. This is called on all providers passed to `Simcoe.run`.
32+
/// Your analytics tracker should start tracking lifecycle data or setup anything else
33+
/// that needs to run for the duration of the analytics lifecycle.
34+
///
35+
/// This is an optional value and is implemented by default in an extension to do nothing.
4136
func start() {
4237

4338
}

Simcoe/Analytics Tracking Protocols/CartLogging.swift

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@
66
// Copyright © 2016 Prolific Interactive. All rights reserved.
77
//
88

9-
/**
10-
* Defines functionality for logging cart actions.
11-
*/
9+
/// Defines functionality for logging cart actions.
1210
public protocol CartLogging: AnalyticsTracking {
1311

1412
/// Logs the addition of a product to the cart.
1513
///
16-
/// - parameter product: The SimcoeProductConvertible instance.
17-
/// - parameter eventProperties: The event properties.
18-
///
19-
/// - returns: A tracking result.
20-
func logAddToCart<T: SimcoeProductConvertible>(product: T, eventProperties: Properties?) -> TrackingResult
14+
/// - Parameters:
15+
/// - product: The SimcoeProductConvertible instance.
16+
/// - eventProperties: The event properties.
17+
/// - Returns: A tracking result.
18+
func logAddToCart<T: SimcoeProductConvertible>(_ product: T, eventProperties: Properties?) -> TrackingResult
2119

2220
/// Logs the removal of a product from the cart.
2321
///
24-
/// - parameter product: The SimcoeProductConvertible instance.
25-
/// - parameter eventProperties: The event properties.
26-
///
27-
/// - returns: A tracking result.
28-
func logRemoveFromCart<T: SimcoeProductConvertible>(product: T, eventProperties: Properties?) -> TrackingResult
22+
/// - Parameters:
23+
/// - product: The SimcoeProductConvertible instance.
24+
/// - eventProperties: The event properties.
25+
/// - Returns: A tracking result.
26+
func logRemoveFromCart<T: SimcoeProductConvertible>(_ product: T, eventProperties: Properties?) -> TrackingResult
2927

3028
}

Simcoe/Analytics Tracking Protocols/CheckoutTracking.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@
66
// Copyright © 2016 Prolific Interactive. All rights reserved.
77
//
88

9-
/**
10-
* Defines functionality for tracking checkout actions.
11-
*/
9+
/// Defines functionality for tracking checkout actions.
1210
public protocol CheckoutTracking: AnalyticsTracking {
1311

1412
/// Tracks a checkout event.
1513
///
16-
/// - parameter products: The products.
17-
/// - parameter eventProperties: The event properties.
18-
///
19-
/// - returns: A tracking result.
20-
func trackCheckoutEvent<T: SimcoeProductConvertible>(products: [T], eventProperties: Properties?) -> TrackingResult
14+
/// - Parameters:
15+
/// - products: The products.
16+
/// - eventProperties: The event properties.
17+
/// - Returns: A tracking result.
18+
func trackCheckoutEvent<T: SimcoeProductConvertible>(_ products: [T], eventProperties: Properties?) -> TrackingResult
2119

2220
}

Simcoe/Analytics Tracking Protocols/ErrorLogging.swift

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,15 @@
66
// Copyright © 2016 Prolific Interactive. All rights reserved.
77
//
88

9-
/**
10-
Defines methods for logging errors to analytics.
11-
*/
9+
/// Defines methods for logging errors to analytics.
1210
public protocol ErrorLogging: AnalyticsTracking {
13-
14-
/**
15-
Logs the error with optional additional properties.
16-
17-
- parameter error: The error to log.
18-
- parameter properties: The optional additional properties.
19-
20-
- returns: A tracking result.
21-
*/
22-
func logError(error: String, withAdditionalProperties properties: Properties?) -> TrackingResult
11+
12+
/// Logs the error with optional additional properties.
13+
///
14+
/// - Parameters:
15+
/// - error: The error to log.
16+
/// - properties: The optional additional properties.
17+
/// - Returns: A tracking result.
18+
func log(error: String, withAdditionalProperties properties: Properties?) -> TrackingResult
2319

2420
}

0 commit comments

Comments
 (0)