Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 3.0 #101

Open
wants to merge 2 commits into
base: swift
Choose a base branch
from
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
19 changes: 11 additions & 8 deletions CWNotificationDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
5EB2509E1B5350580093E304 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5EB2509D1B5350580093E304 /* Assets.xcassets */; };
5EB250A11B5350580093E304 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EB2509F1B5350580093E304 /* LaunchScreen.storyboard */; };
5EC0FBB71B8F8C2900704169 /* CustomView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5EC0FBB61B8F8C2900704169 /* CustomView.xib */; };
5EC0FBBC1B8F8ED500704169 /* CWStatusBarNotification.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */; };
5EC0FBBD1B8F8ED500704169 /* CWStatusBarNotification.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
93E27FC51DFFC9DA001FAB54 /* CWStatusBarNotification.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93E27FC31DFFC9D4001FAB54 /* CWStatusBarNotification.framework */; };
93E27FC61DFFC9DA001FAB54 /* CWStatusBarNotification.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 93E27FC31DFFC9D4001FAB54 /* CWStatusBarNotification.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
5EC0FBBE1B8F8ED500704169 /* Embed Frameworks */ = {
93E27FC21DFFC822001FAB54 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
5EC0FBBD1B8F8ED500704169 /* CWStatusBarNotification.framework in Embed Frameworks */,
93E27FC61DFFC9DA001FAB54 /* CWStatusBarNotification.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -40,15 +40,15 @@
5EB250A01B5350580093E304 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5EB250A21B5350580093E304 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5EC0FBB61B8F8C2900704169 /* CustomView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CustomView.xib; sourceTree = "<group>"; };
5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CWStatusBarNotification.framework; path = CWStatusBarNotification/CWStatusBarNotification.framework; sourceTree = "<group>"; };
93E27FC31DFFC9D4001FAB54 /* CWStatusBarNotification.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CWStatusBarNotification.framework; path = CWStatusBarNotification/CWStatusBarNotification.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
5EB250901B5350580093E304 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5EC0FBBC1B8F8ED500704169 /* CWStatusBarNotification.framework in Frameworks */,
93E27FC51DFFC9DA001FAB54 /* CWStatusBarNotification.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -89,7 +89,7 @@
5EB250A81B5350600093E304 /* CWStatusBarNotification */ = {
isa = PBXGroup;
children = (
5EC0FBB81B8F8E6A00704169 /* CWStatusBarNotification.framework */,
93E27FC31DFFC9D4001FAB54 /* CWStatusBarNotification.framework */,
);
name = CWStatusBarNotification;
sourceTree = "<group>";
Expand All @@ -104,7 +104,7 @@
5EB2508F1B5350580093E304 /* Sources */,
5EB250901B5350580093E304 /* Frameworks */,
5EB250911B5350580093E304 /* Resources */,
5EC0FBBE1B8F8ED500704169 /* Embed Frameworks */,
93E27FC21DFFC822001FAB54 /* Embed Frameworks */,
);
buildRules = (
);
Expand All @@ -126,6 +126,7 @@
TargetAttributes = {
5EB250921B5350580093E304 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0820;
};
};
};
Expand Down Expand Up @@ -289,6 +290,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWNotificationDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -305,6 +307,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = CW.CWNotificationDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
12 changes: 6 additions & 6 deletions CWNotificationDemo/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 Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -59,6 +79,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Expand Down
36 changes: 18 additions & 18 deletions CWNotificationDemo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class MainViewController: UIViewController {
self.updateDurationLabel()

// setup font
let font = UIFont.boldSystemFontOfSize(10.0)
let font = UIFont.boldSystemFont(ofSize: 10.0)
let attributes = [NSFontAttributeName : font]
self.segFromStyle.setTitleTextAttributes(attributes, forState: .Normal)
self.segToStyle.setTitleTextAttributes(attributes, forState: .Normal)
self.segFromStyle.setTitleTextAttributes(attributes, for: .normal)
self.segToStyle.setTitleTextAttributes(attributes, for: .normal)

// set default blue color (since iOS 7.1, default window `tintColor`
// is black)
self.notification.notificationLabelBackgroundColor = UIColor(red: 0.0,
self.notification.backgroundColor = UIColor(red: 0.0,
green: 122.0/255.0, blue: 1.0, alpha: 1.0)
}

Expand All @@ -62,33 +62,33 @@ class MainViewController: UIViewController {
self.segNotificationStyle.selectedSegmentIndex) else {
return
}
self.notification.notificationAnimationInStyle = inStyle
self.notification.notificationAnimationOutStyle = outStyle
self.notification.notificationStyle = notificationStyle
self.notification.animationInStyle = inStyle
self.notification.animationOutStyle = outStyle
self.notification.style = notificationStyle
}

// MARK: - IB actions

@IBAction func sliderDurationChanged(sender: UISlider) {
@IBAction func sliderDurationChanged(_ sender: UISlider) {
self.updateDurationLabel()
}

@IBAction func btnShowNotificationPressed(sender: UIButton) {
@IBAction func btnShowNotificationPressed(_ sender: UIButton) {
self.setupNotification()
let duration = NSTimeInterval(self.sliderDuration.value)
self.notification.displayNotificationWithMessage(
self.txtNotificationMessage.text!, forDuration: duration)
let duration = TimeInterval(self.sliderDuration.value)
self.notification.displayNotification(message:
self.txtNotificationMessage.text!, duration: duration)
}

@IBAction func btnShowCustomNotificationPressed(sender: UIButton) {
@IBAction func btnShowCustomNotificationPressed(_ sender: UIButton) {
self.setupNotification()
let duration = NSTimeInterval(self.sliderDuration.value)
guard let view = NSBundle.mainBundle().loadNibNamed("CustomView",
owner: nil, options: nil)[0] as? UIView else {
let duration = TimeInterval(self.sliderDuration.value)
guard let view = Bundle.main.loadNibNamed("CustomView",
owner: nil, options: nil)?[0] as? UIView else {
return
}
self.notification.displayNotificationWithView(view,
self.notification.displayNotification(view: view,
forDuration: duration)
}

}
}
Binary file not shown.
Loading