diff --git a/Example/main.swift b/Example/main.swift
index a4a476b..8563b5b 100644
--- a/Example/main.swift
+++ b/Example/main.swift
@@ -74,7 +74,7 @@ let counts = System.processCounts()
print("\tPROCESSES: \(counts.processCount)")
print("\tTHREADS: \(counts.threadCount)")
-let loadAverage = System.loadAverage().map { NSString(format:"%.2f", $0) }
+let loadAverage = System.loadAverage().map { Double(round(100*$0)/100) } // Round to 2 decimals
print("\tLOAD AVERAGE: \(loadAverage)")
print("\tMACH FACTOR: \(System.machFactor())")
diff --git a/SystemKit.xcodeproj/project.pbxproj b/SystemKit.xcodeproj/project.pbxproj
index 19c7a91..f69cd54 100644
--- a/SystemKit.xcodeproj/project.pbxproj
+++ b/SystemKit.xcodeproj/project.pbxproj
@@ -231,20 +231,20 @@
4C543D131A08396700C5D9B2 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0830;
+ LastUpgradeCheck = 1000;
ORGANIZATIONNAME = beltex;
TargetAttributes = {
4C4BE6061A083A690085170A = {
CreatedOnToolsVersion = 6.1;
- LastSwiftMigration = 0810;
+ LastSwiftMigration = 1000;
};
4C543D1B1A08396700C5D9B2 = {
CreatedOnToolsVersion = 6.1;
- LastSwiftMigration = 0810;
+ LastSwiftMigration = 1000;
};
4C543D261A08396700C5D9B2 = {
CreatedOnToolsVersion = 6.1;
- LastSwiftMigration = 0810;
+ LastSwiftMigration = 1000;
};
};
};
@@ -341,7 +341,8 @@
);
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -349,7 +350,8 @@
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -361,14 +363,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -409,14 +419,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -459,7 +477,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -479,7 +498,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "beltex.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -499,7 +519,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "beltex.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -515,7 +536,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "beltex.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = Default;
+ SWIFT_VERSION = 4.2;
};
name = Release;
};
diff --git a/SystemKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SystemKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/SystemKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/SystemKit.xcodeproj/xcshareddata/xcschemes/SystemKit.xcscheme b/SystemKit.xcodeproj/xcshareddata/xcschemes/SystemKit.xcscheme
index 70f3e82..24fc06f 100644
--- a/SystemKit.xcodeproj/xcshareddata/xcschemes/SystemKit.xcscheme
+++ b/SystemKit.xcodeproj/xcshareddata/xcschemes/SystemKit.xcscheme
@@ -1,6 +1,6 @@
Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.CurrentCapacity.rawValue as CFString!,
+ Key.CurrentCapacity.rawValue as CFString,
kCFAllocatorDefault,0)
return prop!.takeUnretainedValue() as! Int
}
@@ -176,7 +176,7 @@ public struct Battery {
*/
public func maxCapactiy() -> Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.MaxCapacity.rawValue as CFString!,
+ Key.MaxCapacity.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Int
}
@@ -191,7 +191,7 @@ public struct Battery {
*/
public func designCapacity() -> Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.DesignCapacity.rawValue as CFString!,
+ Key.DesignCapacity.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Int
}
@@ -204,7 +204,7 @@ public struct Battery {
*/
public func cycleCount() -> Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.CycleCount.rawValue as CFString!,
+ Key.CycleCount.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Int
}
@@ -217,7 +217,7 @@ public struct Battery {
*/
public func designCycleCount() -> Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.DesignCycleCount.rawValue as CFString!,
+ Key.DesignCycleCount.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Int
}
@@ -230,7 +230,7 @@ public struct Battery {
*/
public func isACPowered() -> Bool {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.ACPowered.rawValue as CFString!,
+ Key.ACPowered.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Bool
}
@@ -243,7 +243,7 @@ public struct Battery {
*/
public func isCharging() -> Bool {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.IsCharging.rawValue as CFString!,
+ Key.IsCharging.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Bool
}
@@ -256,7 +256,7 @@ public struct Battery {
*/
public func isCharged() -> Bool {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.FullyCharged.rawValue as CFString!,
+ Key.FullyCharged.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Bool
}
@@ -282,7 +282,7 @@ public struct Battery {
*/
public func timeRemaining() -> Int {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.TimeRemaining.rawValue as CFString!,
+ Key.TimeRemaining.rawValue as CFString,
kCFAllocatorDefault, 0)
return prop!.takeUnretainedValue() as! Int
}
@@ -312,7 +312,7 @@ public struct Battery {
*/
public func temperature(_ unit: TemperatureUnit = .celsius) -> Double {
let prop = IORegistryEntryCreateCFProperty(service,
- Key.Temperature.rawValue as CFString!,
+ Key.Temperature.rawValue as CFString,
kCFAllocatorDefault, 0)
var temperature = prop?.takeUnretainedValue() as! Double / 100.0
diff --git a/SystemKit/Info.plist b/SystemKit/Info.plist
index 16cfec2..e77c980 100644
--- a/SystemKit/Info.plist
+++ b/SystemKit/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.0.5
+ 0.0.7
CFBundleSignature
????
CFBundleVersion
diff --git a/SystemKit/System.swift b/SystemKit/System.swift
index c88ffd5..6bccd01 100644
--- a/SystemKit/System.swift
+++ b/SystemKit/System.swift
@@ -188,7 +188,7 @@ public struct System {
else { name = String() }
- ptr.deallocate(capacity: 1)
+ ptr.deallocate()
#if DEBUG
if result != 0 {
@@ -461,7 +461,7 @@ public struct System {
as! Double
}
- status.deallocate(capacity: 1)
+ status.deallocate()
return (processorSpeed, processorCount, schedulerTime)
}
@@ -523,7 +523,7 @@ public struct System {
}
let data = hostInfo.move()
- hostInfo.deallocate(capacity: 1)
+ hostInfo.deallocate()
#if DEBUG
if result != KERN_SUCCESS {
@@ -547,7 +547,7 @@ public struct System {
}
let data = hostInfo.move()
- hostInfo.deallocate(capacity: 1)
+ hostInfo.deallocate()
#if DEBUG
if result != KERN_SUCCESS {
@@ -571,7 +571,7 @@ public struct System {
}
let data = hostInfo.move()
- hostInfo.deallocate(capacity: 1)
+ hostInfo.deallocate()
#if DEBUG
if result != KERN_SUCCESS {
@@ -624,7 +624,7 @@ public struct System {
mach_port_deallocate(mach_task_self_, pset)
let data = info_out.move()
- info_out.deallocate(capacity: 1)
+ info_out.deallocate()
return data
}
@@ -649,7 +649,7 @@ public struct System {
}
let data = hostInfo.move()
- hostInfo.deallocate(capacity: 1)
+ hostInfo.deallocate()
#if DEBUG
if result != KERN_SUCCESS {