Compare commits

...

13 Commits

Author SHA1 Message Date
Yannick Loriot 04716937eb
Merge pull request #16 from phongleq/master
Update package file to create a target.
2019-09-28 11:05:32 +02:00
Phong Le e5fc8f485a Update package file to create a target. 2019-09-27 09:46:44 -06:00
Yannick Loriot 3b3dbfeca4 Updating to Swift 5 2019-04-25 23:12:39 +01:00
Yannick Loriot ab008b3a20
Merge pull request #13 from wallowabk/master
Added configurable size to the "flip point"
2019-04-25 23:03:10 +01:00
Thomas Purnell-Fisher 6580730266 Added configurable size to the "flip point"
This was needed to make the text legible on smaller sized SplitFlap implementations.
2019-04-20 10:41:30 -07:00
Yannick Loriot a6c35eead6
Update README.md 2019-01-07 22:40:26 +01:00
Yannick Loriot fea7e96393
Update README.md 2018-12-29 23:44:26 +01:00
Yannick Loriot bb6752fc8e Bumping to v4.1.0 2018-11-24 19:50:13 +01:00
Yannick Loriot bf43c33deb
Merge pull request #10 from wgvs/seperator_line_transparency
Don't show lines when color is set to nil
2018-11-20 23:35:12 +01:00
Mike Mack 9a6090178d Remove lines 2018-11-19 21:34:30 -08:00
Yannick Loriot fb77534d2c Bump to v4.0.0 2018-09-25 10:31:25 +02:00
Yannick Loriot e2f1e53e91 Updating to Swift 4.2 2018-09-25 10:29:48 +02:00
Yannick Loriot 4a929b03f2
Update .travis.yml 2018-02-06 23:14:58 +01:00
23 changed files with 128 additions and 94 deletions

View File

@ -1 +1 @@
4.0
4.2

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -1,10 +1,10 @@
language: objective-c
osx_image: xcode9
osx_image: xcode10
before_install:
- gem install xcpretty
script:
- cd Example
- xcodebuild -version
- xcodebuild -project SplitflapExample.xcodeproj -scheme SplitflapTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6" -configuration Release GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES test | xcpretty -c
- xcodebuild -project SplitflapExample.xcodeproj -scheme SplitflapTests -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 8" -configuration Release GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES test | xcpretty -c
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@ -1,5 +1,15 @@
# Change log
## [Version 4.1.0](https://github.com/yannickl/Splitflap/releases/tag/4.1.0)
*Released on 2018-11-24.*
- [FIX] Don't show lines when color is set to nil
## [Version 4.0.0](https://github.com/yannickl/Splitflap/releases/tag/4.0.0)
*Released on 2018-09-25.*
**Swift 4.2 Supports**
## [Version 3.0.1](https://github.com/yannickl/Splitflap/releases/tag/3.0.1)
*Released on 2017-12-10.*

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.1</string>
<string>4.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -353,7 +353,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Yannick LORIOT";
TargetAttributes = {
CE5040591C050024007D9E9F = {
@ -362,7 +362,7 @@
};
CE525D871BF3833700429200 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
CE525DAC1BF4FBC800429200 = {
CreatedOnToolsVersion = 7.1;
@ -370,13 +370,13 @@
};
CEB1399F1BF266DD00DE6BA9 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = CEB1399B1BF266DD00DE6BA9 /* Build configuration list for PBXProject "SplitflapExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@ -562,7 +562,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.tvOSExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
@ -578,7 +578,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.tvOSExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
@ -602,7 +602,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.Splitflap;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -626,7 +626,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.Splitflap;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@ -640,7 +640,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.SplitflapTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@ -652,7 +652,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.SplitflapTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
@ -660,6 +660,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@ -668,12 +669,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@ -705,7 +708,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -714,6 +717,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@ -722,12 +726,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
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_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@ -752,7 +758,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@ -767,7 +773,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.SplitflapExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@ -780,7 +786,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.yannickloriot.SplitflapExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};

View File

@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -10,9 +10,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@ -32,7 +31,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.1</string>
<string>4.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -42,7 +42,7 @@ class ViewController: UIViewController, SplitflapDataSource, SplitflapDelegate {
}
fileprivate func updateButtonWithTitle(_ title: String) {
actionButton.setTitle("Say \(words[currentIndex])!", for: UIControlState())
actionButton.setTitle("Say \(words[currentIndex])!", for: UIControl.State())
}
// MARK: - Splitflap DataSource Methods

View File

@ -12,7 +12,7 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.1</string>
<string>4.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -1,31 +1,32 @@
//
// Splitflap
//
// Copyright 2015-present Yannick Loriot.
// http://yannickloriot.com
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Splitflap"
name: "Splitflap",
platforms: [
.macOS(.v10_12),
.iOS(.v8),
.tvOS(.v9)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "Splitflap",
targets: ["Splitflap"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "Splitflap",
dependencies: [],
path: "Sources"
)
]
)

View File

@ -11,7 +11,7 @@
<a href="http://codecov.io/github/yannickl/Splitflap"><img alt="Code coverage status" src="http://codecov.io/github/yannickl/Splitflap/coverage.svg?branch=master"/></a>
</p>
**Splitflap** is a simple to use component to present changeable alphanumeric text like often used as a public transport timetable in airports or railway stations or with some flip clocks.
***🛫 Splitflap*** is a simple to use component to present changeable alphanumeric text like often used as a public transport timetable in airports or railway stations or with some flip clocks.
<p align="center">
<a href="#requirements">Requirements</a><a href="#usage">Usage</a><a href="#installation">Installation</a><a href="#contribution">Contribution</a><a href="#contact">Contact</a><a href="#license-mit">License</a>
@ -21,7 +21,7 @@
- iOS 8.0+ / tvOS 9.0+
- Xcode 9.0+
- Swift 4.0+
- Swift 4.2+
## Usage
@ -109,7 +109,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Splitflap', '~> 3.0.1'
pod 'Splitflap', '~> 4.1.0'
```
Install into your project:
@ -140,7 +140,7 @@ $ brew install carthage
To integrate `Splitflap` into your Xcode project using Carthage, specify it in your `Cartfile` file:
```ogdl
github "yannickl/Splitflap" >= 3.0.1
github "yannickl/Splitflap" >= 4.1.0
```
#### Swift Package Manager
@ -153,7 +153,7 @@ let package = Package(
name: "YOUR_PROJECT_NAME",
targets: [],
dependencies: [
.Package(url: "https://github.com/yannickl/Splitflap.git", versions: "3.0.1" ..< Version.max)
.Package(url: "https://github.com/yannickl/Splitflap.git", versions: "4.1.0" ..< Version.max)
]
)
```

View File

@ -131,15 +131,15 @@ final class FlapView: UIView, CAAnimationDelegate {
topAnim.fromValue = NSValue(caTransform3D: skewedIdentityTransform)
topAnim.toValue = NSValue(caTransform3D: CATransform3DRotate(skewedIdentityTransform, CGFloat.pi / -2, 1, 0, 0))
topAnim.isRemovedOnCompletion = false
topAnim.fillMode = kCAFillModeForwards
topAnim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
topAnim.fillMode = CAMediaTimingFillMode.forwards
topAnim.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn)
bottomAnim.fromValue = NSValue(caTransform3D: CATransform3DRotate(skewedIdentityTransform, CGFloat.pi / 2, 1, 0, 0))
bottomAnim.toValue = NSValue(caTransform3D: skewedIdentityTransform)
bottomAnim.delegate = self
bottomAnim.isRemovedOnCompletion = true
bottomAnim.fillMode = kCAFillModeBoth
bottomAnim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
bottomAnim.fillMode = CAMediaTimingFillMode.both
bottomAnim.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
}
// MARK: - Animating the Flap View
@ -208,8 +208,8 @@ final class FlapView: UIView, CAAnimationDelegate {
topFront.layer.removeAllAnimations()
if animated {
bringSubview(toFront: topFront)
bringSubview(toFront: bottomBack)
bringSubviewToFront(topFront)
bringSubviewToFront(bottomBack)
// Animation
topAnim.beginTime = CACurrentMediaTime()
@ -219,8 +219,8 @@ final class FlapView: UIView, CAAnimationDelegate {
bottomBack.layer.add(bottomAnim, forKey: "bottomDownFlip")
}
else {
bringSubview(toFront: topBack)
bringSubview(toFront: bottomBack)
bringSubviewToFront(topBack)
bringSubviewToFront(bottomBack)
animationTime = animationTime == .tic ? .tac : .tic
}

View File

@ -91,6 +91,12 @@ public final class FlapViewBuilder {
*/
public var lineColor: UIColor? = UIColor.darkGray
/**
The flap's middle line height relative to the default. The default value
id 1.0.
*/
public var flipPointHeightFactor: CGFloat = 1.0
// MARK: - Initializing a Flap View
/**

View File

@ -36,23 +36,23 @@ import Foundation
*/
open class SplitflapTokens {
/// Numeric characters.
open static let Numeric = (0 ... 9).map { String($0) }
public static let Numeric = (0 ... 9).map { String($0) }
/// Alphabetic characters (lower and upper cases).
open static let Alphabetic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".map { String($0) }
public static let Alphabetic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".map { String($0) }
/// Combination of alphabetic (lower and upper cases) and numeric characters.
open static let Alphanumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".map { String($0) }
public static let Alphanumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".map { String($0) }
/// Combination of alphabetic (lower and upper cases) and numeric characters plus the space.
open static let AlphanumericAndSpace = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".map { String($0) }
public static let AlphanumericAndSpace = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".map { String($0) }
/// The 12-hour clock characters (from 1 to 12).
open static let TwelveHourClock = (1 ... 12).map { String($0) }
public static let TwelveHourClock = (1 ... 12).map { String($0) }
/// The 24-hour clock characters (from 00 to 23).
open static let TwentyFourHourClock = (0 ... 23).map { String(format:"%02d", $0) }
public static let TwentyFourHourClock = (0 ... 23).map { String(format:"%02d", $0) }
/// The minute/second characters (from 00 to 59).
open static let MinuteAndSecond = (0 ... 59).map { String(format:"%02d", $0) }
public static let MinuteAndSecond = (0 ... 59).map { String(format:"%02d", $0) }
}

View File

@ -86,6 +86,8 @@ final class TileView: UIView {
// MARK: - Layout the View
fileprivate var flipPointHeightFactor: CGFloat = 1.0
/// Setup the views helping by the given builder.
fileprivate func setupViewsWithBuilder(_ builder: FlapViewBuilder) {
font = builder.font
@ -96,13 +98,17 @@ final class TileView: UIView {
digitLabel.textAlignment = builder.textAlignment
digitLabel.textColor = builder.textColor
digitLabel.backgroundColor = builder.backgroundColor
mainLineView.backgroundColor = builder.lineColor
secondaryLineView.backgroundColor = builder.backgroundColor
flipPointHeightFactor = builder.flipPointHeightFactor
addSubview(digitLabel)
addSubview(mainLineView)
addSubview(secondaryLineView)
// Don't add the line if the color was set to nil
if let lineColor = builder.lineColor {
mainLineView.backgroundColor = lineColor
secondaryLineView.backgroundColor = builder.backgroundColor
addSubview(mainLineView)
addSubview(secondaryLineView)
}
}
// MARK: - Laying out Subviews
@ -132,14 +138,14 @@ final class TileView: UIView {
if position == .top {
digitLabelFrame.size.height = digitLabelFrame.height * 2
digitLabelFrame.origin.y = 0
mainLineViewFrame = CGRect(x: 0, y: bounds.height - 2, width: bounds.width, height: 4)
secondaryLineViewFrame = CGRect(x: 0, y: bounds.height - 1, width: bounds.width, height: 2)
mainLineViewFrame = CGRect(x: 0, y: bounds.height - (2 * flipPointHeightFactor), width: bounds.width, height: 4 * flipPointHeightFactor)
secondaryLineViewFrame = CGRect(x: 0, y: bounds.height - (1 * flipPointHeightFactor), width: bounds.width, height: 2 * flipPointHeightFactor)
}
else {
digitLabelFrame.size.height = digitLabelFrame.height * 2
digitLabelFrame.origin.y = -digitLabelFrame.height / 2
mainLineViewFrame = CGRect(x: 0, y: -2, width: bounds.width, height: 3)
secondaryLineViewFrame = CGRect(x: 0, y: -2, width: bounds.width, height: 2)
mainLineViewFrame = CGRect(x: 0, y: -2 * flipPointHeightFactor, width: bounds.width, height: 3 * flipPointHeightFactor)
secondaryLineViewFrame = CGRect(x: 0, y: -2 * flipPointHeightFactor, width: bounds.width, height: 2 * flipPointHeightFactor)
}
digitLabel.frame = digitLabelFrame

View File

@ -55,7 +55,7 @@ final class TokenGenerator: IteratorProtocol {
}
set(newValue) {
if let value = newValue {
currentIndex = tokens.index(of: value) ?? currentIndex
currentIndex = tokens.firstIndex(of: value) ?? currentIndex
}
else {
currentIndex = 0

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Splitflap'
s.version = '3.0.1'
s.version = '4.1.0'
s.license = 'MIT'
s.summary = 'A simple split-flap display for your Swift applications'
s.description = <<-DESC

View File

@ -27,14 +27,8 @@
import UIKit
import XCTest
class MockAppDelegate: NSObject, UIApplicationDelegate {
}
class XCTTestCaseTemplate: XCTestCase {
override func setUp() {
super.setUp()
UIApplication.shared.delegate = MockAppDelegate()
}
}