Created
March 22, 2018 19:04
-
-
Save charlesferreira/ef8337fa9f1bcd71b90fb3bcff5fc8b0 to your computer and use it in GitHub Desktop.
Exemplo de organização e uso de constantes
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
struct Constants { | |
struct UserDefaults { | |
static let keyForUID = "uid" | |
static let keyForOwnMessages = "ownMessages" | |
static let keyForAllMessages = "allMessages" | |
static let keyForNewMessages = "newMessages" | |
static let showNSFW = "showNSFW" | |
static let hideOwnMessages = "hideOwnMessages" | |
static let hideCollectedMessages = "hideCollectedMessages" | |
} | |
struct GeoFire { | |
let path: String = "geofire" | |
let visibleRadius: Double = 0.2 // in kilometers | |
let collectRadius: Double = 0.025 // in kilometers | |
} | |
} |
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
import UIKit | |
class ExampleViewController: UIViewController { | |
func viewDidLoad() { | |
super.viewDidLoad() | |
print(Constants.UserDefaults.keyForOwnMessages) | |
print(Constants.GeoFire.visibleaRadius) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment