Commit 95842a43 authored by Aral Balkan's avatar Aral Balkan

Swift 3

parents e5aeb061 4c4ecd00
......@@ -7,4 +7,7 @@
<FileRef
location = "group:TimerDemo-iOS/TimerDemo-iOS.xcodeproj">
</FileRef>
<FileRef
location = "group:TimerDemo-Mac/TimerDemo-Mac.xcodeproj">
</FileRef>
</Workspace>
......@@ -93,11 +93,13 @@
A727A9E51C9EF6BF00F44ED3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Aral Balkan";
TargetAttributes = {
A727A9ED1C9EF6BF00F44ED3 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0800;
ProvisioningStyle = Automatic;
};
};
};
......@@ -153,8 +155,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";
......@@ -201,8 +205,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";
......@@ -222,6 +228,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
......@@ -233,6 +240,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
......@@ -240,10 +248,15 @@
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)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
VALID_ARCHS = "arm64 armv7 armv7s x86_64 i386";
};
name = Debug;
};
......@@ -251,6 +264,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
......@@ -258,9 +272,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)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
SWIFT_VERSION = 3.0;
VALID_ARCHS = "arm64 armv7 armv7s x86_64 i386";
};
name = Release;
};
......@@ -283,6 +302,7 @@
A727A9F81C9EF6BF00F44ED3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
......
<?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;
......
......@@ -25,28 +25,28 @@
import Foundation
public class Timer
open class IndieTimer
{
public typealias TickHandler = (Timer)->Void
public typealias TickHandler = (IndieTimer)->Void
var timer:NSTimer?
var timer:Timer?
let tickInterval:Double
let tickHandler:TickHandler
public init(tickInterval:Double, tickHandler: TickHandler)
public init(tickInterval:Double, tickHandler: @escaping TickHandler)
{
self.tickInterval = tickInterval
self.tickHandler = tickHandler
}
public func start(repeats repeats: Bool = true) -> Timer
open func start(_ repeats: Bool = true) -> IndieTimer
{
timer = NSTimer.scheduledTimerWithTimeInterval(tickInterval, target: self, selector: #selector(self.tick), userInfo: nil, repeats: repeats)
timer = Foundation.Timer.scheduledTimer(timeInterval: tickInterval, target: self, selector: #selector(self.tick), userInfo: nil, repeats: repeats)
return self
}
public func stop() -> Timer
open func stop() -> IndieTimer
{
timer?.invalidate()
......
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 {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}
{
"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:IndieTimer?
var elapsedTime:TimeInterval = 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 = DateComponentsFormatter()
formatter.unitsStyle = .spellOut
if let formattedTime = formatter.string(from: 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 =
(
IndieTimer(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,11 +111,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Aral Balkan";
TargetAttributes = {
A727AA211C9EFD8100F44ED3 = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 5Q42VF5GXA;
LastSwiftMigration = 0800;
};
};
};
......@@ -269,14 +269,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/$(CONFIGURATION_BUILD_DIR)",
);
DEVELOPMENT_TEAM = 5Q42VF5GXA;
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_VERSION = 3.0;
};
name = Debug;
};
......@@ -284,14 +283,14 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/$(CONFIGURATION_BUILD_DIR)",
);
DEVELOPMENT_TEAM = 5Q42VF5GXA;
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 = 3.0;
};
name = Release;
};
......
......@@ -13,31 +13,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
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:.
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11198.2" systemVersion="16A304a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
......@@ -15,18 +16,16 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TTP-Ng-Sd5">
<rect key="frame" x="242" y="550" width="34" height="30"/>
<state key="normal" title="Start"/>
<connections>
<action selector="startButtonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Cqy-gB-aXb"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IEo-7P-rln">
<rect key="frame" x="284" y="550" width="32" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="PK3-4D-0Br"/>
</constraints>
......@@ -36,20 +35,18 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JLH-vp-XSy">
<rect key="frame" x="324" y="550" width="39" height="30"/>
<state key="normal" title="Reset"/>
<connections>
<action selector="resetButtonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="uoV-AJ-bPZ"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="one hour, forty-two minutes, thirty seconds" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="5" baselineAdjustment="alignBaselines" minimumFontSize="30" translatesAutoresizingMaskIntoConstraints="NO" id="PXf-M5-QEM">
<rect key="frame" x="20" y="20" width="560" height="522"/>
<fontDescription key="fontDescription" type="system" weight="ultraLight" pointSize="50"/>
<color key="textColor" red="0.41860977564102564" green="0.41860977564102564" blue="0.41860977564102564" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.41860977564102564" green="0.41860977564102564" blue="0.41860977564102564" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="IEo-7P-rln" secondAttribute="bottom" constant="20" id="0eC-71-2SK"/>
<constraint firstItem="JLH-vp-XSy" firstAttribute="leading" secondItem="IEo-7P-rln" secondAttribute="trailing" constant="8" id="6Ve-pj-Q1K"/>
......
......@@ -11,8 +11,8 @@ import Timer
class ViewController: UIViewController
{
var timer:Timer?
var elapsedTime:NSTimeInterval = 0.0 // in seconds.
var timer:IndieTimer?
var elapsedTime:TimeInterval = 0.0 // in seconds.
@IBOutlet weak var displayLabel: UILabel!
......@@ -28,17 +28,17 @@ class ViewController: UIViewController
func reset()
{
timer?.stop()
_ = timer?.stop()
self.elapsedTime = 0.0
updateDisplay()
}
func updateDisplay()
{
let formatter = NSDateComponentsFormatter()
formatter.unitsStyle = .SpellOut
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .spellOut
if let formattedTime = formatter.stringFromTimeInterval(self.elapsedTime)
if let formattedTime = formatter.string(from: self.elapsedTime)
{
self.displayLabel.text = formattedTime
}
......@@ -46,24 +46,24 @@ class ViewController: UIViewController
// MARK: - Actions
@IBAction func resetButtonPressed(sender: UIButton)
@IBAction func resetButtonPressed(_ sender: UIButton)
{
reset()
}
@IBAction func stopButtonPressed(sender: UIButton)
@IBAction func stopButtonPressed(_ sender: UIButton)
{
timer?.stop()
_ = timer?.stop()
}
@IBAction func startButtonPressed(sender: UIButton)
@IBAction func startButtonPressed(_ sender: UIButton)
{
timer?.stop()
_ = timer?.stop()
timer = nil
timer =
(
Timer(tickInterval: 1.0)
IndieTimer(tickInterval: 1.0)
{
/* with */ timer in
......
# Timer
A simple wrapper for NSTimer in Swift that lets you create timers using Swifty syntax and closures.
A simple wrapper for Foundation.Timer in Swift that lets you create timers using Swifty syntax and closures.
**This is the master branch (Swift 2.2.1).** Also available: [Swift 2.3](https://source.ind.ie/project/timer/tree/swift-2.3) and [Swift 3](https://source.ind.ie/project/timer/tree/swift-3) branches.
......@@ -10,6 +10,12 @@ A simple wrapper for NSTimer in Swift that lets you create timers using Swifty s
Run the `./install` script to install the dependencies for the demo app.
To include the Swift 3 version in your own projects, please make sure you specify the swift-3 branch in your Cartfile:
```
git "git@source.ind.ie:project/timer.git" ~> 3.0
```
## Getting started
Run the `./dev` script and play with the iOS demo app.
......@@ -17,7 +23,7 @@ Run the `./dev` script and play with the iOS demo app.
## Usage
```swift
let myTimer = (Timer(tickInterval: 1.0)
let myTimer = (IndieTimer(tickInterval: 1.0))
{
/* with */ timer in
......@@ -26,9 +32,10 @@ let myTimer = (Timer(tickInterval: 1.0)
// Stopping the timer so it doesn’t repeat.
// You can also call .start(repeats: false)
// to achieve the same effect.
timer.stop()
_ = timer.stop()
}).start()
}
myTimer.start()
```
## Credits
......
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