Skip to content

Commit

Permalink
Update all remaining targets to swift 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Sep 8, 2016
1 parent a30d719 commit 48bc141
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 58 deletions.
16 changes: 8 additions & 8 deletions Framework/SwiftTest/AppDelegate.swift
Expand Up @@ -10,16 +10,16 @@ import Cocoa
import CocoaLumberjack
import CocoaLumberjackSwift

let ourLogLevel = DDLogLevel.Verbose
let ourLogLevel = DDLogLevel.verbose

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!

func applicationDidFinishLaunching(aNotification: NSNotification) {
DDLog.addLogger(DDTTYLogger.sharedInstance())
func applicationDidFinishLaunching(_ aNotification: Notification) {
DDLog.add(DDTTYLogger.sharedInstance())

defaultDebugLevel = .Warning
defaultDebugLevel = .warning

DDLogVerbose("Verbose");
DDLogInfo("Info");
Expand All @@ -33,7 +33,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
DDLogWarn("Warn");
DDLogError("Error");

defaultDebugLevel = .Off
defaultDebugLevel = .off

DDLogVerbose("Verbose", level: ourLogLevel);
DDLogInfo("Info", level: ourLogLevel);
Expand All @@ -42,18 +42,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {

DDLogError("Error \(5)", level: ourLogLevel);

defaultDebugLevel = .Verbose
defaultDebugLevel = .verbose

let aDDLogInstance = DDLog()
aDDLogInstance.addLogger(DDTTYLogger.sharedInstance())
aDDLogInstance.add(DDTTYLogger.sharedInstance())

DDLogVerbose("Verbose from aDDLogInstance", ddlog: aDDLogInstance)
DDLogInfo("Info from aDDLogInstance", ddlog: aDDLogInstance)
DDLogWarn("Warn from aDDLogInstance", ddlog: aDDLogInstance)
DDLogError("Error from aDDLogInstance", ddlog: aDDLogInstance)
}

func applicationWillTerminate(aNotification: NSNotification) {
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}
Expand Down
16 changes: 8 additions & 8 deletions Framework/iOSSwift/AppDelegate.swift
Expand Up @@ -10,7 +10,7 @@ import UIKit
import CocoaLumberjack
import CocoaLumberjackSwift

let ddloglevel = DDLogLevel.Verbose
let ddloglevel = DDLogLevel.verbose

private func printSomething() {
DDLogVerbose("Verbose");
Expand All @@ -24,11 +24,11 @@ private func printSomething() {
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let formatter = Formatter()
DDTTYLogger.sharedInstance().logFormatter = formatter
DDLog.addLogger(DDTTYLogger.sharedInstance())
DDLog.add(DDTTYLogger.sharedInstance())

DDLogVerbose("Verbose");
DDLogDebug("Debug");
Expand All @@ -45,25 +45,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
20 changes: 10 additions & 10 deletions Framework/iOSSwift/Formatter.swift
Expand Up @@ -10,30 +10,30 @@ import Foundation
import CocoaLumberjack.DDDispatchQueueLogFormatter

class Formatter: DDDispatchQueueLogFormatter {
let threadUnsafeDateFormatter: NSDateFormatter
let threadUnsafeDateFormatter: DateFormatter

override init() {
threadUnsafeDateFormatter = NSDateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .Behavior10_4
threadUnsafeDateFormatter = DateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .behavior10_4
threadUnsafeDateFormatter.dateFormat = "HH:mm:ss.SSS"

super.init()
}

override func formatLogMessage(logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.stringFromDate(logMessage.timestamp)
override func formatLogMessage(_ logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.string(from: logMessage.timestamp)

var logLevel: String
let logFlag = logMessage.flag
if logFlag.contains(.Error) {
if logFlag.contains(.error) {
logLevel = "E"
} else if logFlag.contains(.Warning){
} else if logFlag.contains(.warning){
logLevel = "W"
} else if logFlag.contains(.Info) {
} else if logFlag.contains(.info) {
logLevel = "I"
} else if logFlag.contains(.Debug) {
} else if logFlag.contains(.debug) {
logLevel = "D"
} else if logFlag.contains(.Verbose) {
} else if logFlag.contains(.verbose) {
logLevel = "V"
} else {
logLevel = "?"
Expand Down
16 changes: 8 additions & 8 deletions Framework/tvOSSwiftTest/AppDelegate.swift
Expand Up @@ -10,7 +10,7 @@ import UIKit
import CocoaLumberjack
import CocoaLumberjackSwift

let ddloglevel = DDLogLevel.Verbose
let ddloglevel = DDLogLevel.verbose

private func printSomething() {
DDLogVerbose("Verbose");
Expand All @@ -26,11 +26,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let formatter = Formatter()
DDTTYLogger.sharedInstance().logFormatter = formatter
DDLog.addLogger(DDTTYLogger.sharedInstance())
DDLog.add(DDTTYLogger.sharedInstance())

DDLogVerbose("Verbose");
DDLogDebug("Debug");
Expand All @@ -47,25 +47,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

Expand Down
20 changes: 10 additions & 10 deletions Framework/tvOSSwiftTest/Formatter.swift
Expand Up @@ -10,30 +10,30 @@ import Foundation
import CocoaLumberjack.DDDispatchQueueLogFormatter

class Formatter: DDDispatchQueueLogFormatter {
let threadUnsafeDateFormatter: NSDateFormatter
let threadUnsafeDateFormatter: DateFormatter

override init() {
threadUnsafeDateFormatter = NSDateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .Behavior10_4
threadUnsafeDateFormatter = DateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .behavior10_4
threadUnsafeDateFormatter.dateFormat = "HH:mm:ss.SSS"

super.init()
}

override func formatLogMessage(logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.stringFromDate(logMessage.timestamp)
override func formatLogMessage(_ logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.string(from: logMessage.timestamp)

var logLevel: String
let logFlag = logMessage.flag
if logFlag.contains(.Error) {
if logFlag.contains(.error) {
logLevel = "E"
} else if logFlag.contains(.Warning){
} else if logFlag.contains(.warning){
logLevel = "W"
} else if logFlag.contains(.Info) {
} else if logFlag.contains(.info) {
logLevel = "I"
} else if logFlag.contains(.Debug) {
} else if logFlag.contains(.debug) {
logLevel = "D"
} else if logFlag.contains(.Verbose) {
} else if logFlag.contains(.verbose) {
logLevel = "V"
} else {
logLevel = "?"
Expand Down
4 changes: 2 additions & 2 deletions Framework/watchOSSwiftTest Extension/ExtensionDelegate.swift
Expand Up @@ -10,7 +10,7 @@ import WatchKit
import CocoaLumberjack
import CocoaLumberjackSwift

let ddloglevel = DDLogLevel.Verbose
let ddloglevel = DDLogLevel.verbose

private func printSomething() {
DDLogVerbose("Verbose");
Expand All @@ -27,7 +27,7 @@ class ExtensionDelegate: NSObject, WKExtensionDelegate {

let formatter = Formatter()
DDTTYLogger.sharedInstance().logFormatter = formatter
DDLog.addLogger(DDTTYLogger.sharedInstance())
DDLog.add(DDTTYLogger.sharedInstance())

DDLogVerbose("Verbose");
DDLogDebug("Debug");
Expand Down
20 changes: 10 additions & 10 deletions Framework/watchOSSwiftTest Extension/Formatter.swift
Expand Up @@ -10,30 +10,30 @@ import Foundation
import CocoaLumberjack.DDDispatchQueueLogFormatter

class Formatter: DDDispatchQueueLogFormatter {
let threadUnsafeDateFormatter: NSDateFormatter
let threadUnsafeDateFormatter: DateFormatter

override init() {
threadUnsafeDateFormatter = NSDateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .Behavior10_4
threadUnsafeDateFormatter = DateFormatter()
threadUnsafeDateFormatter.formatterBehavior = .behavior10_4
threadUnsafeDateFormatter.dateFormat = "HH:mm:ss.SSS"

super.init()
}

override func formatLogMessage(logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.stringFromDate(logMessage.timestamp)
override func formatLogMessage(_ logMessage: DDLogMessage!) -> String {
let dateAndTime = threadUnsafeDateFormatter.string(from: logMessage.timestamp)

var logLevel: String
let logFlag = logMessage.flag
if logFlag.contains(.Error) {
if logFlag.contains(.error) {
logLevel = "E"
} else if logFlag.contains(.Warning){
} else if logFlag.contains(.warning){
logLevel = "W"
} else if logFlag.contains(.Info) {
} else if logFlag.contains(.info) {
logLevel = "I"
} else if logFlag.contains(.Debug) {
} else if logFlag.contains(.debug) {
logLevel = "D"
} else if logFlag.contains(.Verbose) {
} else if logFlag.contains(.verbose) {
logLevel = "V"
} else {
logLevel = "?"
Expand Down
Expand Up @@ -12,8 +12,8 @@ import Foundation

class InterfaceController: WKInterfaceController {

override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
override func awake(withContext context: Any?) {
super.awake(withContext: context)

// Configure interface objects here.
}
Expand Down

0 comments on commit 48bc141

Please sign in to comment.