-
-
Save kurisubrooks/0ba9f7547ee960657dec to your computer and use it in GitHub Desktop.
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
// | |
// eew.playground | |
// | |
// Created by Kurisu Brooks on 4/08/2015. | |
// Copyright © 2015 Lumios. All rights reserved. | |
// | |
import Foundation | |
var quakeArea = "Fukushima" | |
var quakeEpicenter = "462" | |
var quakeMagnitude = 6.2 | |
var quakeSeismic = "5+" | |
var quakeTsunami = 0 | |
func newQuake() -> Void { | |
let notif = NSUserNotification() | |
if quakeTsunami == 0 { | |
var quakeTsunamiWarning = "False" | |
} else if quakeTsunami == 1 { | |
var quakeTsunamiWarning = "True" | |
} else { | |
var quakeTsunamiWarning = "N/A" | |
} | |
notif.title = "Earthquake Warning" | |
notif.subtitle = "An Earthquake has occurred in " + quakeArea | |
notif.informativeText = | |
"Magnitude " + String(stringInterpolationSegment: quakeMagnitude) + | |
", Seismic " + String(quakeSeismic) + | |
", Tsunami: " + String(quakeTsunamiWarning) | |
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notif) | |
} | |
newQuake() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment