Skip to content

Commit

Permalink
Fix warnings (#388)
Browse files Browse the repository at this point in the history
* Fix warnings

* Update travis config to use 9.3
  • Loading branch information
ps2 committed Apr 12, 2018
1 parent 4a3437e commit 489575d
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ DerivedData
*.ipa
*.xcuserstate
*.xcscmblueprint
project.xcworkspace
.DS_Store
*.log

Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: objective-c
osx_image: xcode9.2
xcode_sdk: iphonesimulator11.2
osx_image: xcode9.3
xcode_project: RileyLink.xcodeproj
xcode_scheme: RileyLink
script:
Expand Down
2 changes: 1 addition & 1 deletion MinimedKit/Extensions/Int.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation


extension Int {
init<T: Collection>(bigEndianBytes bytes: T) where T.Iterator.Element == UInt8, T.IndexDistance == Int {
init<T: Collection>(bigEndianBytes bytes: T) where T.Element == UInt8 {
assert(bytes.count <= 4)
var result: UInt = 0

Expand Down
2 changes: 1 addition & 1 deletion MinimedKit/Messages/MySentryAckMessageBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct MySentryAckMessageBody: MessageBody {

sequence = rxData[0]
mySentryID = rxData.subdata(in: 1..<4)
responseMessageTypes = rxData[5..<9].flatMap({ MessageType(rawValue: $0) })
responseMessageTypes = rxData[5..<9].compactMap({ MessageType(rawValue: $0) })
}

public var txData: Data {
Expand Down
6 changes: 5 additions & 1 deletion RileyLink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0900;
LastUpgradeCheck = 0910;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Pete Schwamb";
TargetAttributes = {
431CE76E1F98564100255374 = {
Expand Down Expand Up @@ -3088,12 +3088,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -3145,12 +3147,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
4 changes: 1 addition & 3 deletions RileyLink.xcodeproj/xcshareddata/xcschemes/Crypto.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
8 changes: 3 additions & 5 deletions RileyLink.xcodeproj/xcshareddata/xcschemes/RileyLink.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,9 +40,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -111,7 +110,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 4 additions & 2 deletions RileyLink/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "iTunesArtwork@2x-2.png",
"scale" : "1x"
},
{
Expand Down Expand Up @@ -189,8 +190,9 @@
"subtype" : "42mm"
},
{
"idiom" : "watch-marketing",
"size" : "1024x1024",
"idiom" : "watch-marketing",
"filename" : "iTunesArtwork@2x-1.png",
"scale" : "1x"
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extension RadioSelectionTableViewController {
let vc = T()

vc.selectedIndex = value?.rawValue
vc.options = (0..<2).flatMap({ PumpRegion(rawValue: $0) }).map { String(describing: $0) }
vc.options = (0..<2).compactMap({ PumpRegion(rawValue: $0) }).map { String(describing: $0) }
vc.contextHelp = NSLocalizedString("Pump Region is listed on the back of your pump as two of the last three characters of the model string, which reads something like this: MMT-551NAB, or MMT-515LWWS. If your model has an \"NA\" in it, then the region is NorthAmerica. If your model has an \"WW\" in it, then the region is WorldWide.", comment: "Instructions on selecting the pump region")
return vc
}
Expand Down
2 changes: 1 addition & 1 deletion RileyLinkBLEKit/BLEFirmwareVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public struct BLEFirmwareVersion {
}

self.versionString = versionString
components = versionString[versionIndex...].split(separator: ".").flatMap({ Int($0) })
components = versionString[versionIndex...].split(separator: ".").compactMap({ Int($0) })
}
}

Expand Down
4 changes: 2 additions & 2 deletions RileyLinkBLEKit/CBPeripheral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import CoreBluetooth
// MARK: - Discovery helpers.
extension CBPeripheral {
func servicesToDiscover(from serviceUUIDs: [CBUUID]) -> [CBUUID] {
let knownServiceUUIDs = services?.flatMap({ $0.uuid }) ?? []
let knownServiceUUIDs = services?.compactMap({ $0.uuid }) ?? []
return serviceUUIDs.filter({ !knownServiceUUIDs.contains($0) })
}

func characteristicsToDiscover(from characteristicUUIDs: [CBUUID], for service: CBService) -> [CBUUID] {
let knownCharacteristicUUIDs = service.characteristics?.flatMap({ $0.uuid }) ?? []
let knownCharacteristicUUIDs = service.characteristics?.compactMap({ $0.uuid }) ?? []
return characteristicUUIDs.filter({ !knownCharacteristicUUIDs.contains($0) })
}
}
Expand Down
2 changes: 1 addition & 1 deletion RileyLinkBLEKit/RadioFirmwareVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct RadioFirmwareVersion {
}

self.versionString = versionString
components = versionString[versionIndex...].split(separator: ".").flatMap({ Int($0) })
components = versionString[versionIndex...].split(separator: ".").compactMap({ Int($0) })
}

private init(components: [Int]) {
Expand Down
2 changes: 1 addition & 1 deletion RileyLinkBLEKit/ResponseBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ struct ResponseBuffer<R: Response> {
return []
}

return segments.flatMap { R(legacyData: $0) }
return segments.compactMap { R(legacyData: $0) }
}
}
2 changes: 1 addition & 1 deletion RileyLinkKit/Extensions/RileyLinkDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import RileyLinkBLEKit

extension RileyLinkDevice.Status {
public var firmwareDescription: String {
let versions = [radioFirmwareVersion, bleFirmwareVersion].flatMap { (version: CustomStringConvertible?) -> String? in
let versions = [radioFirmwareVersion, bleFirmwareVersion].compactMap { (version: CustomStringConvertible?) -> String? in
if let version = version {
return String(describing: version)
} else {
Expand Down

0 comments on commit 489575d

Please sign in to comment.