Skip to content

Commit

Permalink
migrat to Swift3 and iOS 10: the old orientation problem has been fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlui committed Sep 20, 2016
1 parent 8b9f644 commit e08fc92
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 99 deletions.
151 changes: 68 additions & 83 deletions SwiftNotice.swift

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions SwiftNoticeExample/SwiftNoticeExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,12 @@
TargetAttributes = {
460ABCC91ADE87C000B43A4E = {
CreatedOnToolsVersion = 6.3;
DevelopmentTeam = B7PY5JUP9A;
LastSwiftMigration = 0800;
};
460ABCDE1ADE87C000B43A4E = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
TestTargetID = 460ABCC91ADE87C000B43A4E;
};
};
Expand Down Expand Up @@ -346,21 +349,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = B7PY5JUP9A;
INFOPLIST_FILE = SwiftNoticeExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.lvwenhan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
460ABCEB1ADE87C000B43A4E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = B7PY5JUP9A;
INFOPLIST_FILE = SwiftNoticeExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.lvwenhan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand All @@ -380,6 +389,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.lvwenhan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftNoticeExample.app/SwiftNoticeExample";
};
name = Debug;
Expand All @@ -396,6 +406,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.lvwenhan.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftNoticeExample.app/SwiftNoticeExample";
};
name = Release;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
12 changes: 6 additions & 6 deletions SwiftNoticeExample/SwiftNoticeExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ 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 {
// 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down
18 changes: 9 additions & 9 deletions SwiftNoticeExample/SwiftNoticeExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent
// UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func topNotice(sender: AnyObject) {
self.noticeTop("OK!")
@IBAction func topNotice(_ sender: AnyObject) {
self.noticeTop("OK!", autoClear: false)
}
@IBAction func wait(sender: AnyObject) {
@IBAction func wait(_ sender: AnyObject) {
// self.pleaseWait()
var imagesArray = Array<UIImage>()
for i in 1...7 {
imagesArray.append(UIImage(named: "loading\(i)")!)
}
self.pleaseWaitWithImages(imagesArray, timeInterval: 50)
}
@IBAction func noticeSuccess(sender: AnyObject) {
@IBAction func noticeSuccess(_ sender: AnyObject) {
self.successNotice("Success!")
self.noticeSuccess("Success!", autoClear: true)
self.noticeSuccess("Success!", autoClear: true, autoClearTime: 10)
}
@IBAction func noticeError(sender: AnyObject) {
@IBAction func noticeError(_ sender: AnyObject) {
self.errorNotice("Error!")
}
@IBAction func noticeInfo(sender: AnyObject) {
@IBAction func noticeInfo(_ sender: AnyObject) {
self.infoNotice("Info")
}
@IBAction func text(sender: AnyObject) {
@IBAction func text(_ sender: AnyObject) {
// SwiftNotice.showText("kiss me baby")
self.noticeOnlyText("Only Text Only Text Only Text Only \nText Only Text Only Text Only\n Text Only Text Only Text ")
}
@IBAction func clear(sender: AnyObject) {
@IBAction func clear(_ sender: AnyObject) {
self.clearAllNotice()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SwiftNoticeExampleTests: XCTestCase {

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
self.measure() {
// Put the code you want to measure the time of here.
}
}
Expand Down

0 comments on commit e08fc92

Please sign in to comment.