Skip to content

Instantly share code, notes, and snippets.

View kgn's full-sized avatar

David Keegan kgn

View GitHub Profile
let twitterUser = JSONMagic(data: serverResponse)["user"]["accounts"][0]["user"].string
extension JSONMagic: CustomStringConvertible {
public var description: String {
if self.value == nil {
return "<No Value>"
}
return "\(self.value!)"
}
}
if let tintColor = configData["tint_color"] as? [CGFloat] where tintColor.count == 3 {
self.window?.tintColor = UIColor(red: tintColor[0], green: tintColor[1], blue: tintColor[2], alpha: 1)
}
if let tintColor = configData["tint_color"] as? [String: CGFloat] {
if let r = tintColor["r"], g = tintColor["g"], b = tintColor["b"] {
self.window?.tintColor = UIColor(red: r, green: g, blue: b, alpha: 1)
}
}
func tintColor(configData: NSDictionary) -> UIColor? {
guard let tintColor = configData["tint_color"] as? [String: CGFloat] else {
return nil
}
guard let r = tintColor["red"], g = tintColor["green"], b = tintColor["blue"] else {
return nil
}
return UIColor(red: r, green: g, blue: b, alpha: 1)
self.window?.tintColor = self.tintColor(configData) ?? UIColor.redColor()
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.messageData.count ?? 0
}
let mainBundle = NSBundle.mainBundle()
let config = mainBundle.pathForResource(“Config”, ofType: “plist”)!
let configData = NSDictionary(contentsOfFile: config)!
userNoteLabel.text = configData["user_note"] as? String