-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fights static access to make singleton. Refs #37.
- Loading branch information
Showing
2 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
import Foundation | ||
|
||
class SGPS | ||
public class Test | ||
{ | ||
static let cInstance: SGPS = SGPS() | ||
init(a: String) { | ||
println("Hello \(a)") | ||
} | ||
} | ||
|
||
@objc public class SGPS | ||
{ | ||
private let _GPS_IS_ON_KEY = "gps_is_on" | ||
private let _KEY_SAVE_SINGLE_POSITION = "save_single_positions" | ||
|
||
static private let cInstance: SGPS = SGPS(); | ||
static private var cSaveAllPositions: Bool = false | ||
|
||
get { return cInstance; } | ||
init() | ||
static func get() -> SGPS { | ||
return cInstance | ||
} | ||
|
||
public init() | ||
{ | ||
let defaults = NSUserDefaults.standardUserDefaults | ||
let gpsIsOn = defaults.boolForKey(_GPS_IS_ON_KEY); | ||
let defaults = NSUserDefaults.standardUserDefaults() | ||
|
||
if defaults.boolForKey(_GPS_IS_ON_KEY) { | ||
start(); | ||
} | ||
SGPS.cSaveAllPositions = defaults.boolForKey(_KEY_SAVE_SINGLE_POSITION); | ||
} | ||
|
||
public func start() | ||
{ | ||
println("Starting!"); | ||
} | ||
} | ||
// const BOOL gps_is_on = [defaults boolForKey:_GPS_IS_ON_KEY]; | ||
// if (gps_is_on) | ||
// [g_ start]; | ||
// | ||
// g_->save_all_positions_ = | ||
// ![defaults boolForKey:_KEY_SAVE_SINGLE_POSITION]; |