Skip to content

Commit

Permalink
Merge pull request #6 from RobotsAndPencils/Swift3
Browse files Browse the repository at this point in the history
Migrate Astro to Swift3
  • Loading branch information
stephengazzard authored Oct 27, 2016
2 parents 2d0511e + 023c41a commit 3dcdcae
Show file tree
Hide file tree
Showing 185 changed files with 12,097 additions and 7,727 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ DerivedData
# Pods/

.idea
.DS_Store
16 changes: 9 additions & 7 deletions Astro.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Astro"
s.version = "2.0.0"
s.version = "3.0.0"
s.summary = "A RoboPod containing a small collection of utilities for project reuse"
s.homepage = "https://RobotsAndPencils.com"
s.license = {
Expand All @@ -25,13 +25,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Chad Sykes" => "[email protected]",
"Colin Gislason" => "[email protected]",
"Dominic Pepin" => "[email protected]",
"Michael Beaureguard" => "[email protected]"
"Michael Beaureguard" => "[email protected]",
"Stephen Gazzard" => "[email protected]"
}
s.source = { :git => "https://github.com/RobotsAndPencils/Astro.git", :tag => s.version.to_s }

s.ios.deployment_target = '8.0'
s.platform = :ios, '8.0'
s.ios.deployment_target = '9.0'
s.platform = :ios, '9.0'
s.requires_arc = true
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' }

s.subspec 'Logging' do | log |
log.source_files = 'Astro/Logging/**/*.swift'
Expand All @@ -40,9 +42,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
s.subspec 'Networking' do | net |
net.source_files = 'Astro/Networking/**/*.swift'
net.dependency 'Astro/Logging'
net.dependency 'Alamofire', '~> 3.3'
net.dependency 'Freddy', '~> 2.0'
net.dependency 'SwiftTask', '5.0'
net.dependency 'Alamofire', '~> 4.0'
net.dependency 'Freddy', '~> 3.0'
net.dependency 'SwiftTask', '~> 5.0'
end

s.subspec 'Security' do | security |
Expand Down
16 changes: 10 additions & 6 deletions Astro.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
E12FAB773EF2299A29253D6A /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -484,7 +484,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -656,12 +656,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Astro/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = RNP.Astro;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -679,11 +680,12 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Astro/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = RNP.Astro;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -693,10 +695,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
INFOPLIST_FILE = AstroTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
PRODUCT_BUNDLE_IDENTIFIER = RNP.AstroTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -706,10 +709,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
INFOPLIST_FILE = AstroTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
PRODUCT_BUNDLE_IDENTIFIER = RNP.AstroTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 2.3;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
48 changes: 24 additions & 24 deletions Astro/Logging/Log.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public protocol Logger {
- Parameter level: Importance level of the message to be logged
- Parameter message: Message contents that will be logged
*/
func log(level: Log.Level, message: String);
func log(_ level: Log.Level, message: String);
}

/**
Expand All @@ -39,31 +39,31 @@ public struct Log {
- Silent - allows you to shut off the logger completely with minimal performance impacts
*/
public enum Level: Int {
case Debug
case Info
case Warning
case Error
case Silent
case debug
case info
case warning
case error
case silent
}

/**
A default logger implementation that logs to NSLog with the log message prefixed by its log Level
*/
public struct BasicLogger: Logger {
public func log(level: Level, message: String) {
public func log(_ level: Level, message: String) {
var prefix = ""

switch level {
case .Debug:
case .debug:
prefix = "DEBUG"
break
case .Info:
case .info:
prefix = "INFO"
break
case .Warning:
case .warning:
prefix = "WARN"
break
case .Error:
case .error:
prefix = "ERROR"
break
default:
Expand All @@ -76,7 +76,7 @@ public struct Log {
/**
Contains the current logging level that is configured
*/
public static var level = Level.Error
public static var level = Level.error

/**
Contains the current logger that is configured
Expand All @@ -86,36 +86,36 @@ public struct Log {
/**
Log a debug message
*/
public static func debug(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Debug.rawValue {
logger.log(.Debug, message: msg())
public static func debug(_ msg: @autoclosure () -> String) {
if level.rawValue <= Level.debug.rawValue {
logger.log(.debug, message: msg())
}
}

/**
Log an info message
*/
public static func info(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Info.rawValue {
logger.log(.Info, message: msg())
public static func info(_ msg: @autoclosure () -> String) {
if level.rawValue <= Level.info.rawValue {
logger.log(.info, message: msg())
}
}

/**
Log a warning message
*/
public static func warn(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Warning.rawValue {
logger.log(.Warning, message: msg())
public static func warn(_ msg: @autoclosure () -> String) {
if level.rawValue <= Level.warning.rawValue {
logger.log(.warning, message: msg())
}
}

/**
Log an error message
*/
public static func error(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Error.rawValue {
logger.log(.Error, message: msg())
public static func error(_ msg: @autoclosure () -> String) {
if level.rawValue <= Level.error.rawValue {
logger.log(.error, message: msg())
}
}
}
Expand Down
Loading

0 comments on commit 3dcdcae

Please sign in to comment.