Commit c0231990 authored by Aral Balkan's avatar Aral Balkan

Add macOS target

parent 12e67a79
<?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;
};
......
......@@ -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()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment