Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

iOS 11/Xcode 9 Compat #1166

Merged
merged 6 commits into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes new warnings around Swift 4's removal of Obj-C type inference.
  • Loading branch information
aaronbrethorst committed Aug 31, 2017
commit d52fc163359a66dbec3ab2ec16a442aaa6c41273
2 changes: 0 additions & 2 deletions OBAKit/Application/OBAApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#import <OBAKit/OBARegionHelper.h>

@class OBAApplicationConfiguration;
@class PrivacyBroker;
@class OBAConsoleLogger;
@class RegionalAlertsManager;

Expand All @@ -41,7 +40,6 @@ extern NSString *const OBARegionServerInvalidNotification;
@property (nonatomic, strong, readonly) OBALocationManager *locationManager;
@property (nonatomic, strong, readonly) RegionalAlertsManager *regionalAlertsManager;
@property (nonatomic, strong, readonly) OBARegionHelper *regionHelper;
@property (nonatomic, strong, readonly) PrivacyBroker *privacyBroker;
@property (nonatomic, strong, readonly) OBAConsoleLogger *consoleLogger;

@property (nonatomic, copy, readonly) NSString *googleAnalyticsID;
Expand Down
3 changes: 0 additions & 3 deletions OBAKit/Application/OBAApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ @interface OBAApplication ()
@property (nonatomic, strong, readwrite) OBAReachability *reachability;
@property (nonatomic, strong, readwrite) OBARegionHelper *regionHelper;
@property (nonatomic, strong, readwrite) RegionalAlertsManager *regionalAlertsManager;
@property (nonatomic, strong, readwrite) PrivacyBroker *privacyBroker;
@property (nonatomic, strong, readwrite) OBALogging *loggingManager;
@end

Expand Down Expand Up @@ -73,8 +72,6 @@ - (void)startWithConfiguration:(OBAApplicationConfiguration *)configuration {

self.regionHelper = [[OBARegionHelper alloc] initWithLocationManager:self.locationManager modelService:self.modelService];

self.privacyBroker = [[PrivacyBroker alloc] initWithModelDAO:self.modelDao locationManager:self.locationManager];

self.regionalAlertsManager = [[RegionalAlertsManager alloc] init];
self.regionalAlertsManager.region = self.modelDao.currentRegion;

Expand Down
2 changes: 1 addition & 1 deletion OBAKit/Helpers/FileHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FileHelpers: NSObject {
/// - fileName: Name of file, including extenion
/// - inDirectory: The search path directory enum value
/// - Returns: The full, absolute path to the specified file, whether or not it exists
public class func pathTo(fileName: String, inDirectory: FileManager.SearchPathDirectory) -> String? {
@objc public class func pathTo(fileName: String, inDirectory: FileManager.SearchPathDirectory) -> String? {
let fileManager = FileManager.init()
guard let directory = try? fileManager.url(for: inDirectory, in: .userDomainMask, appropriateFor: nil, create: true) else {
return nil
Expand Down
14 changes: 7 additions & 7 deletions OBAKit/Helpers/OBAHandoff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import Foundation

class OBAHandoff: NSObject {
static let shared = OBAHandoff()
static let activityType = "org.onebusaway.iphone.handoff"
static let stopIDKey = "stop_ID"
static let regionIDKey = "region_id"
@objc static let shared = OBAHandoff()
@objc static let activityType = "org.onebusaway.iphone.handoff"
@objc static let stopIDKey = "stop_ID"
@objc static let regionIDKey = "region_id"

open internal(set) var activity: NSUserActivity! {
didSet {
Expand All @@ -29,7 +29,7 @@ class OBAHandoff: NSObject {
/// Begin broadcasting the specified URL
/// - parameter URL: URL to broadcast, if `nil`,
/// this will stop broadcasting
open func broadcast(_ URL: URL?) {
@objc open func broadcast(_ URL: URL?) {
activity.webpageURL = URL
activity.becomeCurrent()
}
Expand All @@ -39,7 +39,7 @@ class OBAHandoff: NSObject {
/// - Parameters:
/// - stop: Stop ID to broadcast
/// - region: The OBARegionV2 object associated with the specified stopID
open func broadcast(stopID stop: String, withRegion region: OBARegionV2) {
@objc open func broadcast(stopID stop: String, withRegion region: OBARegionV2) {
let userInfo: [AnyHashable: Any] = [
OBAHandoff.stopIDKey: stop,
OBAHandoff.regionIDKey: region.identifier
Expand All @@ -49,7 +49,7 @@ class OBAHandoff: NSObject {
}

/// Stop broadcasting to other devices.
open func stopBroadcasting() {
@objc open func stopBroadcasting() {
activity.userInfo = nil
activity.webpageURL = nil
activity.resignCurrent()
Expand Down
162 changes: 0 additions & 162 deletions OBAKit/Models/privacy/PrivacyBroker.swift

This file was deleted.

22 changes: 7 additions & 15 deletions OBAKit/OBAKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
934196421DB0B099004BBBB7 /* OBASetNextOBAJsonDigesterRule.m in Sources */ = {isa = PBXBuildFile; fileRef = 934195A41DB0B099004BBBB7 /* OBASetNextOBAJsonDigesterRule.m */; };
934196431DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 934195A51DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.h */; };
934196441DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.m in Sources */ = {isa = PBXBuildFile; fileRef = 934195A61DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.m */; };
934196461DB0B099004BBBB7 /* PrivacyBroker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934195A91DB0B099004BBBB7 /* PrivacyBroker.swift */; };
934196471DB0B099004BBBB7 /* OBAAgencyV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 934195AB1DB0B099004BBBB7 /* OBAAgencyV2.h */; settings = {ATTRIBUTES = (Public, ); }; };
934196481DB0B099004BBBB7 /* OBAAgencyV2.m in Sources */ = {isa = PBXBuildFile; fileRef = 934195AC1DB0B099004BBBB7 /* OBAAgencyV2.m */; };
934196491DB0B099004BBBB7 /* OBAAgencyWithCoverageV2.h in Headers */ = {isa = PBXBuildFile; fileRef = 934195AD1DB0B099004BBBB7 /* OBAAgencyWithCoverageV2.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -341,7 +340,6 @@
934195A41DB0B099004BBBB7 /* OBASetNextOBAJsonDigesterRule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBASetNextOBAJsonDigesterRule.m; sourceTree = "<group>"; };
934195A51DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBASetPropertyJsonDigesterRule.h; sourceTree = "<group>"; };
934195A61DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBASetPropertyJsonDigesterRule.m; sourceTree = "<group>"; };
934195A91DB0B099004BBBB7 /* PrivacyBroker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivacyBroker.swift; sourceTree = "<group>"; };
934195AB1DB0B099004BBBB7 /* OBAAgencyV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBAAgencyV2.h; sourceTree = "<group>"; };
934195AC1DB0B099004BBBB7 /* OBAAgencyV2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBAAgencyV2.m; sourceTree = "<group>"; };
934195AD1DB0B099004BBBB7 /* OBAAgencyWithCoverageV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBAAgencyWithCoverageV2.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -646,7 +644,6 @@
934195851DB0B099004BBBB7 /* annotations */,
9341958E1DB0B099004BBBB7 /* dao */,
934195941DB0B099004BBBB7 /* json_digester */,
934195A81DB0B099004BBBB7 /* privacy */,
934195AA1DB0B099004BBBB7 /* unmanaged */,
);
path = Models;
Expand Down Expand Up @@ -704,14 +701,6 @@
path = json_digester;
sourceTree = "<group>";
};
934195A81DB0B099004BBBB7 /* privacy */ = {
isa = PBXGroup;
children = (
934195A91DB0B099004BBBB7 /* PrivacyBroker.swift */,
);
path = privacy;
sourceTree = "<group>";
};
934195AA1DB0B099004BBBB7 /* unmanaged */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1063,6 +1052,7 @@
TargetAttributes = {
934195381DB0B013004BBBB7 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
934195411DB0B013004BBBB7 = {
Expand Down Expand Up @@ -1209,7 +1199,6 @@
9341964E1DB0B099004BBBB7 /* OBAArrivalAndDepartureV2.m in Sources */,
934196421DB0B099004BBBB7 /* OBASetNextOBAJsonDigesterRule.m in Sources */,
CCD30CFB1E30564600080EFF /* OBAHandoff.swift in Sources */,
934196461DB0B099004BBBB7 /* PrivacyBroker.swift in Sources */,
934196D41DB0C02F004BBBB7 /* NSDate+DateTools.m in Sources */,
9341965D1DB0B099004BBBB7 /* OBAHasReferencesV2.m in Sources */,
934196441DB0B099004BBBB7 /* OBASetPropertyJsonDigesterRule.m in Sources */,
Expand Down Expand Up @@ -1396,8 +1385,9 @@
PRODUCT_BUNDLE_IDENTIFIER = org.onebusaway.iphone.OBAKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -1421,8 +1411,9 @@
PRODUCT_BUNDLE_IDENTIFIER = org.onebusaway.iphone.OBAKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down Expand Up @@ -1525,8 +1516,9 @@
PRODUCT_BUNDLE_IDENTIFIER = org.onebusaway.iphone.OBAKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = AppStoreDistribution;
};
Expand Down
2 changes: 1 addition & 1 deletion OBAKit/UI/Controls/BorderedButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BorderedButton: UIButton {
}
}

public convenience init(borderColor: UIColor, title: String) {
@objc public convenience init(borderColor: UIColor, title: String) {
self.init(frame: CGRect.zero)
self.borderColor = borderColor
self.configure()
Expand Down
15 changes: 8 additions & 7 deletions OBAKit/regional_alerts/RegionalAlertsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import CocoaLumberjack
import CocoaLumberjackSwift

/*
Expand All @@ -20,10 +21,10 @@ import CocoaLumberjackSwift

@objc public class RegionalAlertsManager: NSObject {
private let lastUpdateKey = "OBALastRegionalAlertsUpdateKey"
private(set) public var regionalAlerts: [OBARegionalAlert] = []
@objc private(set) public var regionalAlerts: [OBARegionalAlert] = []
private let alertsUpdateQueue = DispatchQueue(label: "regional-alerts-manager-update")

public var region: OBARegionV2? {
@objc public var region: OBARegionV2? {
didSet {
self.regionalAlerts = self.loadDefaultData() ?? []
}
Expand All @@ -33,7 +34,7 @@ import CocoaLumberjackSwift
return OBAApplication.shared().modelService
}()

public var unreadCount: UInt {
@objc public var unreadCount: UInt {
return UInt(self.regionalAlerts.filter({ $0.unread }).count)
}

Expand Down Expand Up @@ -79,7 +80,7 @@ import CocoaLumberjackSwift
private let updateLock = NSLock.init()

/// Loads alerts for the currently selected region.
public func update() {
@objc public func update() {
guard let region = self.region else {
return
}
Expand Down Expand Up @@ -143,9 +144,9 @@ import CocoaLumberjackSwift

// MARK: - Notifications

public static let regionalAlertsUpdatedNotification = NSNotification.Name("regionalAlertsUpdatedNotification")
public static let highPriorityRegionalAlertReceivedNotification = NSNotification.Name("highPriorityRegionalAlertReceivedNotification")
public static let highPriorityRegionalAlertUserInfoKey = "HighPriorityRegionalAlertUserInfoKey"
@objc public static let regionalAlertsUpdatedNotification = NSNotification.Name("regionalAlertsUpdatedNotification")
@objc public static let highPriorityRegionalAlertReceivedNotification = NSNotification.Name("highPriorityRegionalAlertReceivedNotification")
@objc public static let highPriorityRegionalAlertUserInfoKey = "HighPriorityRegionalAlertUserInfoKey"

private func broadcastUpdateNotification() {
NotificationCenter.default.post(name: RegionalAlertsManager.regionalAlertsUpdatedNotification, object: self)
Expand Down
Loading