Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jakeswedenburg.xcuserdatad
.DS_Store
8 changes: 8 additions & 0 deletions Stormy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@
TargetAttributes = {
218C583519D86BA20054DBD0 = {
CreatedOnToolsVersion = 6.0.1;
LastSwiftMigration = 0810;
};
218C584A19D86BA30054DBD0 = {
CreatedOnToolsVersion = 6.0.1;
LastSwiftMigration = 0810;
TestTargetID = 218C583519D86BA20054DBD0;
};
};
Expand Down Expand Up @@ -380,10 +382,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Stormy/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -394,10 +398,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Stormy/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand All @@ -417,6 +423,7 @@
INFOPLIST_FILE = StormyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stormy.app/Stormy";
};
name = Debug;
Expand All @@ -432,6 +439,7 @@
INFOPLIST_FILE = StormyTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Stormy.app/Stormy";
};
name = Release;
Expand Down
16 changes: 8 additions & 8 deletions Stormy/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ 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 {

application.setStatusBarHidden(true, withAnimation: .None)
application.setStatusBarHidden(true, with: .none)

application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [UIUserNotificationType.Sound, UIUserNotificationType.Alert, UIUserNotificationType.Badge], categories: nil))
application.registerUserNotificationSettings(UIUserNotificationSettings(types: [UIUserNotificationType.sound, UIUserNotificationType.alert, UIUserNotificationType.badge], categories: nil))


//sleep(2);
// Override point for customization after application launch.
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
18 changes: 9 additions & 9 deletions Stormy/Current.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct Current {
var windSpeed: Double


init (weatherDictionary: NSDictionary) {
init (weatherDictionary: [String: Any]) {

let currentWeather = weatherDictionary["currently"] as! NSDictionary
temperature = currentWeather["temperature"] as! Int
Expand All @@ -35,23 +35,23 @@ struct Current {

//Date formatter

func dateStringFromUnixtime(unixTime: Int) -> String {
func dateStringFromUnixtime(_ unixTime: Int) -> String {

let timeInSeconds = NSTimeInterval(unixTime)
let weatherDate = NSDate(timeIntervalSince1970: timeInSeconds)
let timeInSeconds = TimeInterval(unixTime)
let weatherDate = Date(timeIntervalSince1970: timeInSeconds)

let dateFormatter = NSDateFormatter()
dateFormatter.timeStyle = .MediumStyle
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .medium

return dateFormatter.stringFromDate(weatherDate)
return dateFormatter.string(from: weatherDate)


}


//Images

func weatherIconFromString(stringIcon: String) -> UIImage {
func weatherIconFromString(_ stringIcon: String) -> UIImage {

var imageName: String

Expand Down Expand Up @@ -85,7 +85,7 @@ func weatherIconFromString(stringIcon: String) -> UIImage {

}

func Fahrenheit2Celsius(f: Int) -> Int {
func Fahrenheit2Celsius(_ f: Int) -> Int {
return Int((Double(f)-32.0) / 1.8)
}

Expand Down
14 changes: 7 additions & 7 deletions Stormy/InfoTabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ class InfoTabViewController: UIViewController {

func infoAnimation() {

self.thermometer.transform = CGAffineTransformMakeTranslation(0, 1000)
self.projectName.transform = CGAffineTransformMakeTranslation(0, 100)
self.forecast.transform = CGAffineTransformMakeTranslation(0, 100)
self.thermometer.transform = CGAffineTransform(translationX: 0, y: 1000)
self.projectName.transform = CGAffineTransform(translationX: 0, y: 100)
self.forecast.transform = CGAffineTransform(translationX: 0, y: 100)

springWithDelay(0.9, delay: 0.50, animations: {
self.thermometer.transform = CGAffineTransformMakeTranslation(0, 0)
self.thermometer.transform = CGAffineTransform(translationX: 0, y: 0)
})
springWithDelay(0.9, delay: 0.50, animations: {
self.projectName.transform = CGAffineTransformMakeTranslation(0, 0)
self.projectName.transform = CGAffineTransform(translationX: 0, y: 0)
})
springWithDelay(0.9, delay: 0.50, animations: {
self.forecast.transform = CGAffineTransformMakeTranslation(0, 0)
self.forecast.transform = CGAffineTransform(translationX: 0, y: 0)
})
}



@IBAction func backButtonPressed(sender: AnyObject) {
@IBAction func backButtonPressed(_ sender: AnyObject) {

}

Expand Down
68 changes: 34 additions & 34 deletions Stormy/SpringAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ var delay = 0.0
var damping = 0.7
var velocity = 0.7

func spring(duration: NSTimeInterval, animations: (() -> Void)!) {
func spring(_ duration: TimeInterval, animations: (() -> Void)!) {

UIView.animateWithDuration(duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {
UIView.animate(withDuration: duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {

animations()

Expand All @@ -24,9 +24,9 @@ func spring(duration: NSTimeInterval, animations: (() -> Void)!) {
})
}

func springWithDelay(duration: NSTimeInterval, delay: NSTimeInterval, animations: (() -> Void)!) {
func springWithDelay(_ duration: TimeInterval, delay: TimeInterval, animations: (() -> Void)!) {

UIView.animateWithDuration(duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: [], animations: {
UIView.animate(withDuration: duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: [], animations: {

animations()

Expand All @@ -35,17 +35,17 @@ func springWithDelay(duration: NSTimeInterval, delay: NSTimeInterval, animations
})
}

func slideUp(duration: NSTimeInterval, animations: (() -> Void)!) {
UIView.animateWithDuration(duration, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: [], animations: {
func slideUp(_ duration: TimeInterval, animations: (() -> Void)!) {
UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.8, options: [], animations: {

animations()

}, completion: nil)
}

func springWithCompletion(duration: NSTimeInterval, animations: (() -> Void)!, completion: ((Bool) -> Void)!) {
func springWithCompletion(_ duration: TimeInterval, animations: (() -> Void)!, completion: ((Bool) -> Void)!) {

UIView.animateWithDuration(duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {
UIView.animate(withDuration: duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {

animations()

Expand All @@ -54,47 +54,47 @@ func springWithCompletion(duration: NSTimeInterval, animations: (() -> Void)!, c
})
}

func springScaleFrom (view: UIView, x: CGFloat, y: CGFloat, scaleX: CGFloat, scaleY: CGFloat) {
let translation = CGAffineTransformMakeTranslation(x, y)
let scale = CGAffineTransformMakeScale(scaleX, scaleY)
view.transform = CGAffineTransformConcat(translation, scale)
func springScaleFrom (_ view: UIView, x: CGFloat, y: CGFloat, scaleX: CGFloat, scaleY: CGFloat) {
let translation = CGAffineTransform(translationX: x, y: y)
let scale = CGAffineTransform(scaleX: scaleX, y: scaleY)
view.transform = translation.concatenating(scale)

UIView.animateWithDuration(0.7, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {
UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {

let translation = CGAffineTransformMakeTranslation(0, 0)
let scale = CGAffineTransformMakeScale(1, 1)
view.transform = CGAffineTransformConcat(translation, scale)
let translation = CGAffineTransform(translationX: 0, y: 0)
let scale = CGAffineTransform(scaleX: 1, y: 1)
view.transform = translation.concatenating(scale)

}, completion: nil)
}

func springScaleTo (view: UIView, x: CGFloat, y: CGFloat, scaleX: CGFloat, scaleY: CGFloat) {
let translation = CGAffineTransformMakeTranslation(0, 0)
let scale = CGAffineTransformMakeScale(1, 1)
view.transform = CGAffineTransformConcat(translation, scale)
func springScaleTo (_ view: UIView, x: CGFloat, y: CGFloat, scaleX: CGFloat, scaleY: CGFloat) {
let translation = CGAffineTransform(translationX: 0, y: 0)
let scale = CGAffineTransform(scaleX: 1, y: 1)
view.transform = translation.concatenating(scale)

UIView.animateWithDuration(duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {
UIView.animate(withDuration: duration, delay: delay, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.7, options: [], animations: {

let translation = CGAffineTransformMakeTranslation(x, y)
let scale = CGAffineTransformMakeScale(scaleX, scaleY)
view.transform = CGAffineTransformConcat(translation, scale)
let translation = CGAffineTransform(translationX: x, y: y)
let scale = CGAffineTransform(scaleX: scaleX, y: scaleY)
view.transform = translation.concatenating(scale)

}, completion: nil)
}

func popoverTopRight(view: UIView) {
view.hidden = false
let translate = CGAffineTransformMakeTranslation(200, -200)
let scale = CGAffineTransformMakeScale(0.3, 0.3)
func popoverTopRight(_ view: UIView) {
view.isHidden = false
let translate = CGAffineTransform(translationX: 200, y: -200)
let scale = CGAffineTransform(scaleX: 0.3, y: 0.3)
view.alpha = 0
view.transform = CGAffineTransformConcat(translate, scale)
view.transform = translate.concatenating(scale)

UIView.animateWithDuration(0.6, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0.8, options: [], animations: {
UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0.8, options: [], animations: {

let translate = CGAffineTransformMakeTranslation(0, 0)
let scale = CGAffineTransformMakeScale(1, 1)
view.transform = CGAffineTransformConcat(translate, scale)
let translate = CGAffineTransform(translationX: 0, y: 0)
let scale = CGAffineTransform(scaleX: 1, y: 1)
view.transform = translate.concatenating(scale)
view.alpha = 1

}, completion: nil)
}
}
Loading