Update to Swift 4.1

This commit is contained in:
Jeroen Wesbeek 2018-03-27 11:50:06 +02:00
parent 3f15b4d32e
commit 5383f5f97c
5 changed files with 4 additions and 9 deletions

View File

@ -7,10 +7,7 @@ disabled_rules:
opt_in_rules:
- force_unwrapping
excluded:
- Carthage
- Pods
- NPOKit/Carthage
- NPOKit/Pods
identifier_name:
min_length: 2
file_length:
@ -19,5 +16,3 @@ file_length:
type_body_length:
warning: 350
error: 500
excluded:
- Pods

View File

@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.platforms = { :ios => '11.0', :osx => '12.0', :tvos => '11.0' }
spec.requires_arc = true
spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.1' }
spec.source = { :git => 'https://github.com/4np/NPOKit.git', :tag => "#{spec.version}" }
spec.default_subspecs = 'Core'

View File

@ -25,7 +25,7 @@ public extension NPOKit {
internal func fetchModel<T: Codable>(ofType type: T.Type, forURL url: URL, postData: Data?, completionHandler: @escaping (Result<T>) -> Void) {
let task = dataTask(forUrl: url, postData: postData, cachePolicy: .reloadIgnoringLocalCacheData) { (result) in
var jsonData: Data
// check the request was successful
switch result {
case .success(let data, _):

View File

@ -16,7 +16,7 @@ public extension NPOKit {
let nowPlayingComponents = container.components.filter({ $0.type == .nowPlaying })
// additionally, we're only interested in the live broadcasts
let broadcasts = nowPlayingComponents.flatMap({ $0.broadcasts }).flatMap({ $0 })
let broadcasts = nowPlayingComponents.compactMap({ $0.broadcasts }).flatMap({ $0 })
completionHandler(.success(broadcasts))
case .failure(let error):

View File

@ -78,7 +78,7 @@ public extension NPOKit {
}
// remove optionals
let nonOptionalLines = lines.flatMap({ $0 })
let nonOptionalLines = lines.compactMap({ $0 })
completionHandler(.success(nonOptionalLines))
}