...
 
Commits (4)
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<Group
location = "group:TimerDemo-Mac"
name = "TimerDemo-Mac">
<Group
location = "group:TimerDemo-Mac"
name = "TimerDemo-Mac">
<FileRef
location = "group:AppDelegate.swift">
</FileRef>
<Group
location = "group:Assets.xcassets"
name = "Assets.xcassets">
<Group
location = "group:AppIcon.appiconset"
name = "AppIcon.appiconset">
<FileRef
location = "group:Contents.json">
</FileRef>
</Group>
</Group>
<Group
location = "group:Base.lproj"
name = "Base.lproj">
<FileRef
location = "group:Main.storyboard">
</FileRef>
</Group>
<FileRef
location = "group:Info.plist">
</FileRef>
<FileRef
location = "group:ViewController.swift">
</FileRef>
</Group>
<FileRef
location = "group:TimerDemo-Mac.xcodeproj">
</FileRef>
</Group>
<FileRef
location = "group:Timer/Timer.xcodeproj">
</FileRef>
......
......@@ -241,11 +241,14 @@
INFOPLIST_FILE = Timer/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = ind.ie.Timer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 2.3;
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64";
};
name = Debug;
};
......@@ -260,10 +263,13 @@
INFOPLIST_FILE = Timer/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = ind.ie.Timer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_VERSION = 2.3;
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64";
};
name = Release;
};
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
......@@ -6,7 +6,7 @@
// Copyright © 2016 Aral Balkan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
//! Project version number for Timer.
FOUNDATION_EXPORT double TimerVersionNumber;
......
This diff is collapsed.
//
// AppDelegate.swift
// TimerDemo-Mac
//
// Created by Aral Balkan on 29/08/2016.
// Copyright © 2016 Aral Balkan. All rights reserved.
//
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate
{
// Nothing yet.
}
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Aral Balkan. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
//
// ViewController.swift
// TimerDemo-Mac
//
// Created by Aral Balkan on 29/08/2016.
// Copyright © 2016 Aral Balkan. All rights reserved.
//
import Cocoa
import Timer
class ViewController: NSViewController
{
var timer:Timer?
var elapsedTime:NSTimeInterval = 0.0 // in seconds.
@IBOutlet weak var displayLabel: NSTextField!
// MARK: - View lifecycle
override func viewDidLoad()
{
super.viewDidLoad()
reset()
}
// MARK: - Private
func reset()
{
_ = timer?.stop()
self.elapsedTime = 0.0
updateDisplay()
}
func updateDisplay()
{
let formatter = NSDateComponentsFormatter()
formatter.unitsStyle = .SpellOut
if let formattedTime = formatter.stringFromTimeInterval(self.elapsedTime)
{
self.displayLabel.stringValue = formattedTime
}
}
// MARK: - Actions
@IBAction func resetButtonPressed(sender: NSButton)
{
reset()
}
@IBAction func stopButtonPressed(sender: NSButton)
{
_ = timer?.stop()
}
@IBAction func startButtonPressed(sender: NSButton)
{
_ = timer?.stop()
timer = nil
timer =
(
Timer(tickInterval: 1.0)
{
/* with */ timer in
self.elapsedTime += 1
self.updateDisplay()
}
)
.start()
}
}
......@@ -12,7 +12,6 @@
A727AA2B1C9EFD8100F44ED3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A727AA291C9EFD8100F44ED3 /* Main.storyboard */; };
A727AA2D1C9EFD8100F44ED3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A727AA2C1C9EFD8100F44ED3 /* Assets.xcassets */; };
A727AA301C9EFD8100F44ED3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A727AA2E1C9EFD8100F44ED3 /* LaunchScreen.storyboard */; };
A72BFA0A1CA43209002BAD35 /* Timer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A72BFA091CA43209002BAD35 /* Timer.framework */; };
A7394BDE1CA4377A0096FF28 /* Timer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A72BFA091CA43209002BAD35 /* Timer.framework */; };
A7394BDF1CA4377A0096FF28 /* Timer.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A72BFA091CA43209002BAD35 /* Timer.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
......@@ -48,7 +47,6 @@
buildActionMask = 2147483647;
files = (
A7394BDE1CA4377A0096FF28 /* Timer.framework in Frameworks */,
A72BFA0A1CA43209002BAD35 /* Timer.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -113,7 +111,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Aral Balkan";
TargetAttributes = {
A727AA211C9EFD8100F44ED3 = {
......@@ -198,8 +196,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
......@@ -242,8 +242,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
......@@ -270,10 +272,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/$(CONFIGURATION_BUILD_DIR)",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "TimerDemo-iOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ind.ie.TimerDemo-iOS";
......@@ -286,14 +285,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/$(CONFIGURATION_BUILD_DIR)",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "TimerDemo-iOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "ind.ie.TimerDemo-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 2.3;
};
name = Release;
......
......@@ -2,9 +2,9 @@
A simple wrapper for NSTimer in Swift that lets you create timers using Swifty syntax and closures.
**This is the Swift 2.3 branch.**
**This is the Swift 2.3 branch.** Also available: [Master (Swift 2.2.1)](https://source.ind.ie/project/timer/tree/master) and [Swift 3](https://source.ind.ie/project/timer/tree/swift-3) branches.
See `master` branch for the current release (Swift 2.2.1) version and the `swift-3` branch for the Swift 3.x version.
**Supported on:** Xcode 8 Beta 6
## Installation
......