diff --git a/RxCocoa/Common/_RXDelegateProxy.h b/RxCocoa/Common/_RXDelegateProxy.h index 03b93bd8..22a5a402 100644 --- a/RxCocoa/Common/_RXDelegateProxy.h +++ b/RxCocoa/Common/_RXDelegateProxy.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak, readonly) id _forwardToDelegate; --(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate; +-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate; -(BOOL)hasWiredImplementationForSelector:(SEL)selector; diff --git a/RxCocoa/Common/_RXDelegateProxy.m b/RxCocoa/Common/_RXDelegateProxy.m index e5fe3335..2cbffa5a 100644 --- a/RxCocoa/Common/_RXDelegateProxy.m +++ b/RxCocoa/Common/_RXDelegateProxy.m @@ -96,7 +96,7 @@ static NSMutableDictionary *forwardableSelectorsPerClass = nil; return __forwardToDelegate; } --(void)_setForwardToDelegate:(id)forwardToDelegate retainDelegate:(BOOL)retainDelegate { +-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate { __forwardToDelegate = forwardToDelegate; if (retainDelegate) { self.strongForwardDelegate = forwardToDelegate; diff --git a/RxExample/RxDataSources/DataSources+Rx/UISectionedViewType+RxAnimatedDataSource.swift b/RxExample/RxDataSources/DataSources+Rx/UISectionedViewType+RxAnimatedDataSource.swift index 08689914..27e932c2 100644 --- a/RxExample/RxDataSources/DataSources+Rx/UISectionedViewType+RxAnimatedDataSource.swift +++ b/RxExample/RxDataSources/DataSources+Rx/UISectionedViewType+RxAnimatedDataSource.swift @@ -18,17 +18,17 @@ extension UITableView { public func rx_itemsAnimatedWithDataSource< DataSource: RxTableViewDataSourceType & UITableViewDataSource, S: Sequence, - O: ObservableType - where - DataSource.Element == S, - O.E == S, - S.Iterator.Element: AnimatableSectionModelType - > + O: ObservableType> (_ dataSource: DataSource) - -> (source: O) - -> Disposable { + -> (_ source: O) + -> Disposable + where + DataSource.Element == S, + O.E == S, + S.Iterator.Element: AnimatableSectionModelType + { return { source in - return self.rx_itemsWithDataSource(dataSource)(source: source) + return self.rx_itemsWithDataSource(dataSource)(source) } } } @@ -38,17 +38,17 @@ extension UICollectionView { public func rx_itemsAnimatedWithDataSource< DataSource: RxCollectionViewDataSourceType & UICollectionViewDataSource, S: Sequence, - O: ObservableType - where - DataSource.Element == S, - O.E == S, - S.Iterator.Element: AnimatableSectionModelType - > + O: ObservableType> (_ dataSource: DataSource) - -> (source: O) - -> Disposable { + -> (_ source: O) + -> Disposable + where + DataSource.Element == S, + O.E == S, + S.Iterator.Element: AnimatableSectionModelType + { return { source in - return self.rx_itemsWithDataSource(dataSource)(source: source) + return self.rx_itemsWithDataSource(dataSource)(source) } } } diff --git a/RxExample/RxDataSources/DataSources/CollectionViewSectionedDataSource.swift b/RxExample/RxDataSources/DataSources/CollectionViewSectionedDataSource.swift index 24802b55..ba984961 100644 --- a/RxExample/RxDataSources/DataSources/CollectionViewSectionedDataSource.swift +++ b/RxExample/RxDataSources/DataSources/CollectionViewSectionedDataSource.swift @@ -142,14 +142,14 @@ public class CollectionViewSectionedDataSource } } - public var moveItem: ((CollectionViewSectionedDataSource, sourceIndexPath:IndexPath, destinationIndexPath:IndexPath) -> Void)? { + public var moveItem: ((CollectionViewSectionedDataSource, _ sourceIndexPath:IndexPath, _ destinationIndexPath:IndexPath) -> Void)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } - public var canMoveItemAtIndexPath: ((CollectionViewSectionedDataSource, indexPath:IndexPath) -> Bool)? { + public var canMoveItemAtIndexPath: ((CollectionViewSectionedDataSource, IndexPath) -> Bool)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() @@ -196,7 +196,7 @@ public class CollectionViewSectionedDataSource } override func _rx_collectionView(_ collectionView: UICollectionView, canMoveItemAtIndexPath indexPath: IndexPath) -> Bool { - guard let canMoveItem = canMoveItemAtIndexPath?(self, indexPath: indexPath) else { + guard let canMoveItem = canMoveItemAtIndexPath?(self, indexPath) else { return super._rx_collectionView(collectionView, canMoveItemAtIndexPath: indexPath) } diff --git a/RxExample/RxDataSources/DataSources/TableViewSectionedDataSource.swift b/RxExample/RxDataSources/DataSources/TableViewSectionedDataSource.swift index 856dfd2b..c454b584 100644 --- a/RxExample/RxDataSources/DataSources/TableViewSectionedDataSource.swift +++ b/RxExample/RxDataSources/DataSources/TableViewSectionedDataSource.swift @@ -165,14 +165,14 @@ public class RxTableViewSectionedDataSource } } - public var titleForHeaderInSection: ((RxTableViewSectionedDataSource, section: Int) -> String?)? { + public var titleForHeaderInSection: ((RxTableViewSectionedDataSource, Int) -> String?)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } - public var titleForFooterInSection: ((RxTableViewSectionedDataSource, section: Int) -> String?)? { + public var titleForFooterInSection: ((RxTableViewSectionedDataSource, Int) -> String?)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() @@ -180,14 +180,14 @@ public class RxTableViewSectionedDataSource } } - public var canEditRowAtIndexPath: ((RxTableViewSectionedDataSource, indexPath: IndexPath) -> Bool)? { + public var canEditRowAtIndexPath: ((RxTableViewSectionedDataSource, IndexPath) -> Bool)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() #endif } } - public var canMoveRowAtIndexPath: ((RxTableViewSectionedDataSource, indexPath: IndexPath) -> Bool)? { + public var canMoveRowAtIndexPath: ((RxTableViewSectionedDataSource, IndexPath) -> Bool)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() @@ -205,7 +205,7 @@ public class RxTableViewSectionedDataSource #endif } } - public var sectionForSectionIndexTitle:((RxTableViewSectionedDataSource, title: String, index: Int) -> Int)? { + public var sectionForSectionIndexTitle:((RxTableViewSectionedDataSource, _ title: String, _ index: Int) -> Int)? { didSet { #if DEBUG ensureNotMutatedAfterBinding() @@ -242,15 +242,15 @@ public class RxTableViewSectionedDataSource } override func _rx_tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - return titleForHeaderInSection?(self, section: section) + return titleForHeaderInSection?(self, section) } override func _rx_tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { - return titleForFooterInSection?(self, section: section) + return titleForFooterInSection?(self, section) } override func _rx_tableView(_ tableView: UITableView, canEditRowAtIndexPath indexPath: IndexPath) -> Bool { - guard let canEditRow = canEditRowAtIndexPath?(self, indexPath: indexPath) else { + guard let canEditRow = canEditRowAtIndexPath?(self, indexPath) else { return super._rx_tableView(tableView, canEditRowAtIndexPath: indexPath) } @@ -258,7 +258,7 @@ public class RxTableViewSectionedDataSource } override func _rx_tableView(_ tableView: UITableView, canMoveRowAtIndexPath indexPath: IndexPath) -> Bool { - guard let canMoveRow = canMoveRowAtIndexPath?(self, indexPath: indexPath) else { + guard let canMoveRow = canMoveRowAtIndexPath?(self, indexPath) else { return super._rx_tableView(tableView, canMoveRowAtIndexPath: indexPath) } @@ -279,7 +279,7 @@ public class RxTableViewSectionedDataSource } override func _rx_tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int { - guard let section = sectionForSectionIndexTitle?(self, title: title, index: index) else { + guard let section = sectionForSectionIndexTitle?(self, title, index) else { return super._rx_tableView(tableView, sectionForSectionIndexTitle: title, atIndex: index) } diff --git a/RxExample/RxExample/Examples/APIWrappers/APIWrappersViewController.swift b/RxExample/RxExample/Examples/APIWrappers/APIWrappersViewController.swift index 9bc0efb7..4733de1b 100644 --- a/RxExample/RxExample/Examples/APIWrappers/APIWrappersViewController.swift +++ b/RxExample/RxExample/Examples/APIWrappers/APIWrappersViewController.swift @@ -14,7 +14,7 @@ import RxCocoa #endif extension UILabel { - public override var accessibilityValue: String! { + open override var accessibilityValue: String! { get { return self.text } diff --git a/RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesAPI.swift b/RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesAPI.swift index c3a380fc..2dd246db 100644 --- a/RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesAPI.swift +++ b/RxExample/RxExample/Examples/GitHubSearchRepositories/GitHubSearchRepositoriesAPI.swift @@ -102,7 +102,7 @@ class GitHubSearchRepositoriesAPI { // Do we really want to make this example project factory/fascade/service competition? :) private let _wireframe: Wireframe - private let _reachabilityService: ReachabilityService + fileprivate let _reachabilityService: ReachabilityService private init(wireframe: Wireframe, reachabilityService: ReachabilityService) { _wireframe = wireframe @@ -197,7 +197,7 @@ extension GitHubSearchRepositoriesAPI { private static let parseLinksPattern = "\\s*,?\\s*<([^\\>]*)>\\s*;\\s*rel=\"([^\"]*)\"" private static let linksRegex = try! NSRegularExpression(pattern: parseLinksPattern, options: [.allowCommentsAndWhitespace]) - private static func parseLinks(_ links: String) throws -> [String: String] { + fileprivate static func parseLinks(_ links: String) throws -> [String: String] { let length = (links as NSString).length let matches = GitHubSearchRepositoriesAPI.linksRegex.matches(in: links, options: NSRegularExpression.MatchingOptions(), range: NSRange(location: 0, length: length)) @@ -223,7 +223,7 @@ extension GitHubSearchRepositoriesAPI { return result } - private static func parseNextURL(_ httpResponse: HTTPURLResponse) throws -> URL? { + fileprivate static func parseNextURL(_ httpResponse: HTTPURLResponse) throws -> URL? { guard let serializedLinks = httpResponse.allHeaderFields["Link"] as? String else { return nil } @@ -241,15 +241,15 @@ extension GitHubSearchRepositoriesAPI { return nextUrl } - private static func parseJSON(_ httpResponse: HTTPURLResponse, data: Data) throws -> AnyObject { + fileprivate static func parseJSON(_ httpResponse: HTTPURLResponse, data: Data) throws -> AnyObject { if !(200 ..< 300 ~= httpResponse.statusCode) { throw exampleError("Call failed") } - return try JSONSerialization.jsonObject(with: data ?? Data(), options: []) + return try JSONSerialization.jsonObject(with: data, options: []) as AnyObject } - private static func parseRepositories(_ json: [String: AnyObject]) throws -> [Repository] { + fileprivate static func parseRepositories(_ json: [String: AnyObject]) throws -> [Repository] { guard let items = json["items"] as? [[String: AnyObject]] else { throw exampleError("Can't find items") } diff --git a/RxExample/RxExample/Examples/GitHubSearchRepositories/UINavigationController+Extensions.swift b/RxExample/RxExample/Examples/GitHubSearchRepositories/UINavigationController+Extensions.swift index df441a8a..2ef7f583 100644 --- a/RxExample/RxExample/Examples/GitHubSearchRepositories/UINavigationController+Extensions.swift +++ b/RxExample/RxExample/Examples/GitHubSearchRepositories/UINavigationController+Extensions.swift @@ -23,8 +23,7 @@ extension UINavigationController { return UIBindingObserver(UIElement: self) { navigationController, maybeServiceState in // if nil is being bound, then don't change color, it's not perfect, but :) if let serviceState = maybeServiceState { - let safeState = (serviceState ?? .online) - let isOffline = safeState == .offline + let isOffline = serviceState == .offline self.navigationBar.backgroundColor = isOffline ? Colors.OfflineColor diff --git a/RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift b/RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift index 35342a15..d339015e 100644 --- a/RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift +++ b/RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift @@ -28,7 +28,7 @@ func dismissViewController(_ viewController: UIViewController, animated: Bool) { } extension UIImagePickerController { - static func rx_createWithParent(_ parent: UIViewController?, animated: Bool = true, configureImagePicker: (UIImagePickerController) throws -> () = { x in }) -> Observable { + static func rx_createWithParent(_ parent: UIViewController?, animated: Bool = true, configureImagePicker: @escaping (UIImagePickerController) throws -> () = { x in }) -> Observable { return Observable.create { [weak parent] observer in let imagePicker = UIImagePickerController() let dismissDisposable = imagePicker diff --git a/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift b/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift index 62959bcd..49ce3acb 100644 --- a/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift +++ b/RxExample/RxExample/Examples/SimpleTableViewExampleSectioned/SimpleTableViewExampleSectionedViewController.swift @@ -70,7 +70,7 @@ class SimpleTableViewExampleSectionedViewController func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let label = UILabel(frame: CGRect.zero) - label.text = dataSource.sectionAtIndex(section).model ?? "" + label.text = dataSource.sectionAtIndex(section).model return label } } diff --git a/RxExample/RxExample/Examples/WikipediaImageSearch/ViewModels/SearchResultViewModel.swift b/RxExample/RxExample/Examples/WikipediaImageSearch/ViewModels/SearchResultViewModel.swift index 1b383d01..300c09de 100644 --- a/RxExample/RxExample/Examples/WikipediaImageSearch/ViewModels/SearchResultViewModel.swift +++ b/RxExample/RxExample/Examples/WikipediaImageSearch/ViewModels/SearchResultViewModel.swift @@ -60,7 +60,7 @@ class SearchResultViewModel { .observeOn($.backgroundWorkScheduler) .map { page in do { - return try parseImageURLsfromHTMLSuitableForDisplay(page.text) + return try parseImageURLsfromHTMLSuitableForDisplay(page.text as NSString) } catch { return [] } diff --git a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift index 6167f1a1..633e29dc 100644 --- a/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift +++ b/RxExample/RxExample/Examples/WikipediaImageSearch/Views/WikipediaSearchCell.swift @@ -38,7 +38,7 @@ public class WikipediaSearchCell: UITableViewCell { .drive(self.titleOutlet.rx_text) .addDisposableTo(disposeBag) - self.URLOutlet.text = viewModel.searchResult.URL.absoluteString ?? "" + self.URLOutlet.text = viewModel.searchResult.URL.absoluteString let reachabilityService = Dependencies.sharedDependencies.reachabilityService viewModel.imageURLs diff --git a/RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaPage.swift b/RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaPage.swift index 5b943588..faeae484 100644 --- a/RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaPage.swift +++ b/RxExample/RxExample/Examples/WikipediaImageSearch/WikipediaAPI/WikipediaPage.swift @@ -22,8 +22,11 @@ struct WikipediaPage { // tedious parsing part static func parseJSON(_ json: NSDictionary) throws -> WikipediaPage { - guard let title = json.value(forKey: "parse")?.value(forKey: "title") as? String, - let text = json.value(forKey: "parse")?.value(forKey: "text")?.value(forKey: "*") as? String else { + guard + let parse = json.value(forKey: "parse"), + let title = (parse as AnyObject).value(forKey: "title") as? String, + let t = (parse as AnyObject).value(forKey: "text"), + let text = (t as AnyObject).value(forKey: "*") as? String else { throw apiError("Error parsing page content") } diff --git a/RxExample/RxExample/Operators.swift b/RxExample/RxExample/Operators.swift index 1ed6126b..3084753d 100644 --- a/RxExample/RxExample/Operators.swift +++ b/RxExample/RxExample/Operators.swift @@ -16,8 +16,7 @@ import UIKit // Two way binding operator between control property and variable, that's all it takes { -infix operator <-> { -} +infix operator <-> : DefaultPrecedence func nonMarkedText(_ textInput: UITextInput) -> String? { let start = textInput.beginningOfDocument diff --git a/RxExample/RxExample/Services/ActivityIndicator.swift b/RxExample/RxExample/Services/ActivityIndicator.swift index e678378f..c11e9168 100644 --- a/RxExample/RxExample/Services/ActivityIndicator.swift +++ b/RxExample/RxExample/Services/ActivityIndicator.swift @@ -16,7 +16,7 @@ private struct ActivityToken : ObservableConvertibleType, Disposable { private let _source: Observable private let _dispose: Cancelable - init(source: Observable, disposeAction: () -> ()) { + init(source: Observable, disposeAction: @escaping () -> ()) { _source = source _dispose = Disposables.create(with: disposeAction) } @@ -49,7 +49,7 @@ public class ActivityIndicator : DriverConvertibleType { .distinctUntilChanged() } - private func trackActivityOfObservable(_ source: O) -> Observable { + fileprivate func trackActivityOfObservable(_ source: O) -> Observable { return Observable.using({ () -> ActivityToken in self.increment() return ActivityToken(source: source.asObservable(), disposeAction: self.decrement) diff --git a/RxExample/RxExample/Services/ImageService.swift b/RxExample/RxExample/Services/ImageService.swift index 3d99c636..08388a92 100644 --- a/RxExample/RxExample/Services/ImageService.swift +++ b/RxExample/RxExample/Services/ImageService.swift @@ -57,7 +57,7 @@ class DefaultImageService: ImageService { private func _imageFromURL(_ url: URL) -> Observable { return Observable.deferred { - let maybeImage = self._imageCache.object(forKey: url) as? Image + let maybeImage = self._imageCache.object(forKey: url as AnyObject) as? Image let decodedImage: Observable @@ -66,7 +66,7 @@ class DefaultImageService: ImageService { decodedImage = Observable.just(image) } else { - let cachedData = self._imageDataCache.object(forKey: url) as? Data + let cachedData = self._imageDataCache.object(forKey: url as AnyObject) as? Data // does image data cache contain anything if let cachedData = cachedData { @@ -76,7 +76,7 @@ class DefaultImageService: ImageService { // fetch from network decodedImage = self.$.URLSession.rx_data(URLRequest(url: url)) .do(onNext: { data in - self._imageDataCache.setObject(data, forKey: url) + self._imageDataCache.setObject(data as AnyObject, forKey: url as AnyObject) }) .flatMap(self.decodeImage) .trackActivity(self.loadingImage) @@ -84,7 +84,7 @@ class DefaultImageService: ImageService { } return decodedImage.do(onNext: { image in - self._imageCache.setObject(image, forKey: url) + self._imageCache.setObject(image, forKey: url as AnyObject) }) } } diff --git a/RxExample/RxExample/Services/Reachability.swift b/RxExample/RxExample/Services/Reachability.swift index 464e38b8..0a187f9b 100644 --- a/RxExample/RxExample/Services/Reachability.swift +++ b/RxExample/RxExample/Services/Reachability.swift @@ -37,7 +37,7 @@ enum ReachabilityError: Swift.Error { public let ReachabilityChangedNotification = "ReachabilityChangedNotification" -func callback(_ reachability:SCNetworkReachability, flags: SCNetworkReachabilityFlags, info: UnsafeMutablePointer?) { +func callback(_ reachability:SCNetworkReachability, flags: SCNetworkReachabilityFlags, info: UnsafeMutableRawPointer?) { guard let info = info else { return } let reachability = Unmanaged.fromOpaque(info).takeUnretainedValue() @@ -110,11 +110,13 @@ public class Reachability: NSObject { public class func reachabilityForInternetConnection() throws -> Reachability { var zeroAddress = sockaddr_in() - zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress)) + zeroAddress.sin_len = UInt8(MemoryLayout.size) zeroAddress.sin_family = sa_family_t(AF_INET) - guard let ref = withUnsafePointer(&zeroAddress, { - SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0)) + guard let ref = withUnsafePointer(to: &zeroAddress, { + $0.withMemoryRebound(to: sockaddr.self, capacity: 1) { + SCNetworkReachabilityCreateWithAddress(nil, $0) + } }) else { throw ReachabilityError.failedToCreateWithAddress(zeroAddress) } return Reachability(reachabilityRef: ref) @@ -123,15 +125,17 @@ public class Reachability: NSObject { public class func reachabilityForLocalWiFi() throws -> Reachability { var localWifiAddress: sockaddr_in = sockaddr_in(sin_len: __uint8_t(0), sin_family: sa_family_t(0), sin_port: in_port_t(0), sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) - localWifiAddress.sin_len = UInt8(sizeofValue(localWifiAddress)) + localWifiAddress.sin_len = UInt8(MemoryLayout.size) localWifiAddress.sin_family = sa_family_t(AF_INET) // IN_LINKLOCALNETNUM is defined in as 169.254.0.0 let address: UInt32 = 0xA9FE0000 localWifiAddress.sin_addr.s_addr = in_addr_t(address.bigEndian) - guard let ref = withUnsafePointer(&localWifiAddress, { - SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0)) + guard let ref = withUnsafePointer(to: &localWifiAddress, { + $0.withMemoryRebound(to: sockaddr.self, capacity: 1) { + SCNetworkReachabilityCreateWithAddress(nil, $0) + } }) else { throw ReachabilityError.failedToCreateWithAddress(localWifiAddress) } return Reachability(reachabilityRef: ref) @@ -226,7 +230,7 @@ public class Reachability: NSObject { private var reachabilityRef: SCNetworkReachability? private let reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability") - private func reachabilityChanged(_ flags: SCNetworkReachabilityFlags) { + fileprivate func reachabilityChanged(_ flags: SCNetworkReachabilityFlags) { if isReachableWithFlags(flags) { if let block = whenReachable { block(self) @@ -267,8 +271,8 @@ public class Reachability: NSObject { if let reachabilityRef = reachabilityRef { var flags = SCNetworkReachabilityFlags(rawValue: 0) - let gotFlags = withUnsafeMutablePointer(&flags) { - SCNetworkReachabilityGetFlags(reachabilityRef, UnsafeMutablePointer($0)) + let gotFlags = withUnsafeMutablePointer(to: &flags) { + SCNetworkReachabilityGetFlags(reachabilityRef, $0) } if gotFlags { @@ -348,8 +352,8 @@ public class Reachability: NSObject { if let reachabilityRef = reachabilityRef { var flags = SCNetworkReachabilityFlags(rawValue: 0) - let gotFlags = withUnsafeMutablePointer(&flags) { - SCNetworkReachabilityGetFlags(reachabilityRef, UnsafeMutablePointer($0)) + let gotFlags = withUnsafeMutablePointer(to: &flags) { + SCNetworkReachabilityGetFlags(reachabilityRef, $0) } if gotFlags { diff --git a/RxExample/RxExample/iOS/AppDelegate.swift b/RxExample/RxExample/iOS/AppDelegate.swift index d1bb1578..6b93f620 100644 --- a/RxExample/RxExample/iOS/AppDelegate.swift +++ b/RxExample/RxExample/iOS/AppDelegate.swift @@ -12,10 +12,6 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - // Override point for customization after application launch. - return true - } + }