Skip to content

Commit

Permalink
Merge branch 'deploy/1.3.0' into productive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Sep 18, 2016
2 parents e93aecb + b3f0d9e commit 7e86034
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 407 deletions.
6 changes: 0 additions & 6 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# rule identifiers to exclude from running
disabled_rules:
- trailing_newline
- trailing_whitespace
- cyclomatic_complexity

# some rules are only opt-in
opt_in_rules:
- empty_count
Expand Down
7 changes: 5 additions & 2 deletions HandySwift.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "HandySwift"
s.version = "1.2.0"
s.version = "1.3.0"
s.summary = "Handy Swift features that didn't make it into the Swift standard library"

s.description = <<-DESC
Expand All @@ -20,8 +20,11 @@ Pod::Spec.new do |s|
s.osx.deployment_target = "10.10"
s.tvos.deployment_target = "9.0"

s.source = { :git => "https://github.com/Flinesoft/HandySwift.git", :tag => "1.2.0" }
s.source = { :git => "https://github.com/Flinesoft/HandySwift.git", :tag => "1.3.0" }
s.source_files = "Sources", "Sources/**/*.swift"
s.framework = "Foundation"
s.osx.framework = "AppKit"
s.ios.framework = "UIKit"
s.tvos.framework = "UIKit"

end
31 changes: 30 additions & 1 deletion HandySwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
82CAE2971C2EE95200F934A7 /* ArrayExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayExtensionTests.swift; sourceTree = "<group>"; };
82F22E551C26434900E784A2 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
82F967F31C67A65E0003F12A /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; };
A16B85EB1D8EA9A200B39055 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -193,6 +194,7 @@
823B2B271C24AAB6007B3CDD = {
isa = PBXGroup;
children = (
A16B85EB1D8EA9A200B39055 /* README.md */,
82F967F31C67A65E0003F12A /* .swiftlint.yml */,
82F22E551C26434900E784A2 /* Package.swift */,
825EFDE11C3333CE00558497 /* Sources */,
Expand Down Expand Up @@ -449,26 +451,32 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Flinesoft;
TargetAttributes = {
823B2B301C24AAB6007B3CDD = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
823B2B3A1C24AAB7007B3CDD = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
825EFDC91C3333B000558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
825EFDD21C3333B000558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
825EFDE81C33351200558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
825EFDF11C33351300558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -727,8 +735,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;
COPY_PHASE_STRIP = NO;
Expand Down Expand Up @@ -776,8 +786,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;
COPY_PHASE_STRIP = NO;
Expand All @@ -797,6 +809,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_MODULE_NAME = HandySwift;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
Expand All @@ -811,6 +824,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -824,6 +838,7 @@
PRODUCT_NAME = HandySwift;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -833,6 +848,7 @@
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -845,6 +861,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.HandySwift;
PRODUCT_NAME = HandySwift;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -857,6 +874,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.flinesoft.HandySwift-iOS-Tests";
PRODUCT_MODULE_NAME = HandySwift_iOS_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -869,6 +887,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.flinesoft.HandySwift-iOS-Tests";
PRODUCT_MODULE_NAME = HandySwift_iOS_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -891,6 +910,7 @@
PRODUCT_NAME = HandySwift;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -913,6 +933,7 @@
PRODUCT_NAME = HandySwift;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -929,6 +950,7 @@
PRODUCT_MODULE_NAME = HandySwift_OSX_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -945,13 +967,15 @@
PRODUCT_MODULE_NAME = HandySwift_OSX_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_VERSION = 3.0;
};
name = Release;
};
825EFDFB1C33351300558497 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -964,6 +988,7 @@
PRODUCT_NAME = HandySwift;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -973,6 +998,7 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -985,6 +1011,7 @@
PRODUCT_NAME = HandySwift;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -1000,6 +1027,7 @@
PRODUCT_MODULE_NAME = HandySwift_tvOS_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.1;
};
name = Debug;
Expand All @@ -1014,6 +1042,7 @@
PRODUCT_MODULE_NAME = HandySwift_tvOS_Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.1;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
<img src="https://www.bitrise.io/app/810d996d77fb0abf.svg?token=kr27kfE1r8jE0qdtpXgIzw&branch=stable"
alt="Build Status">
</a>
<a href="https://codebeat.co/projects/github-com-flinesoft-handyswift">
<img src="https://codebeat.co/badges/283e545d-02e9-4fcf-aabc-40cacfbfe26c"
alt="codebeat badge">
</a>
<a href="https://github.com/Flinesoft/HandySwift/releases">
<img src="https://img.shields.io/badge/Version-1.2.0-blue.svg"
alt="Version: 1.2.0">
<img src="https://img.shields.io/badge/Version-1.3.0-blue.svg"
alt="Version: 1.3.0">
</a>
<img src="https://img.shields.io/badge/Swift-2.2-FFAC45.svg"
alt="Swift: 2.2">
<img src="https://img.shields.io/badge/Swift-3-FFAC45.svg"
alt="Swift: 3">
<img src="https://img.shields.io/badge/Platforms-iOS%20%7C%20tvOS%20%7C%20OS%20X-FF69B4.svg"
alt="Platforms: iOS | tvOS | OS X">
<a href="https://github.com/Flinesoft/HandySwift/blob/stable/LICENSE.md">
Expand Down Expand Up @@ -87,7 +91,7 @@ var date = NSDate() // Without delay: 2016-06-07 05:38:03 +0000
delay(bySeconds: 1.5) { // Runs in Main thread by default
date = NSDate() // Delayed by 1.5 seconds: 2016-06-07 05:38:05 +0000
}
delay(bySeconds: 5, dispatchLevel: .UserInteractive) {
delay(bySeconds: 5, dispatchLevel: .userInteractive) {
date = NSDate() // Delayed by 5 seconds: 2016-06-07 05:38:08 +0000
}
```
Expand Down Expand Up @@ -145,10 +149,10 @@ Checks if String contains any characters other than whitespace characters.
Get random numeric/alphabetic/alphanumeric String of given length.

``` Swift
String(randomWithLength: 4, allowedCharactersType: .Numeric) // => "8503"
String(randomWithLength: 6, allowedCharactersType: .Alphabetic) // => "ysTUzU"
String(randomWithLength: 8, allowedCharactersType: .AlphaNumeric) // => "2TgM5sUG"
String(randomWithLength: 10, allowedCharactersType: .AllCharactersIn("?!🐲🍏✈️🎎🍜"))
String(randomWithLength: 4, allowedCharactersType: .numeric) // => "8503"
String(randomWithLength: 6, allowedCharactersType: .alphabetic) // => "ysTUzU"
String(randomWithLength: 8, allowedCharactersType: .alphaNumeric) // => "2TgM5sUG"
String(randomWithLength: 10, allowedCharactersType: .allCharactersIn("?!🐲🍏✈️🎎🍜"))
// => "!🍏🐲✈️🎎🐲🍜??🍜"
```

Expand All @@ -159,8 +163,8 @@ String(randomWithLength: 10, allowedCharactersType: .AllCharactersIn("?!🐲🍏
Returns a random element within the array or nil if array empty.

``` Swift
[1, 2, 3, 4, 5].sample // => 4
([] as [Int]).sample // => nil
[1, 2, 3, 4, 5].sample() // => 4
([] as [Int]).sample() // => nil
```

#### .sample(size:)
Expand Down Expand Up @@ -237,7 +241,7 @@ Creates a new `UIColor` object with a single attribute changed by a given differ

``` Swift
rgbaColor.rgba.blue // => 0.3
let newRgbaColor = rgbaColor.change(.Blue, by: 0.2)
let newRgbaColor = rgbaColor.change(.blue, by: 0.2)
newRgbaColor.rgba.blue // => 0.5
```

Expand All @@ -246,11 +250,11 @@ Creates a new `UIColor` object with the value of a single attribute set to a giv

``` Swift
hsbaColor.hsba.brightness // => 0.3
let newHsbaColor = hsbaColor.change(.Brightness, to: 0.8)
let newHsbaColor = hsbaColor.change(.brightness, to: 0.8)
newHsbaColor.hsba.brightness // => 0.8
```

### CoreGraphicsExtensions
### CoreGraphicsExtensions (partly iOS & tvOS only)

#### CGSize.inPixels / CGSize.inPixels(screen:)
Returns a new CGSize object with the width and height converted to true pixels on screen.
Expand All @@ -259,7 +263,7 @@ Returns a new CGSize object with the width and height converted to true pixels o
let size = CGSize(width: 100, height: 50)
size.inPixels // test this with a Retina screen target
// => {w 50 h 25}
size.inPixels(UIScreen.screens().last!) // pass a different screen
size.inPixels(UIScreen.screens.last!) // pass a different screen
// => {w 100 h 50}
```

Expand All @@ -270,7 +274,7 @@ Returns a new CGPoint object with the x and y converted to true pixels on screen
let point = CGPoint(x: 100, y: 50)
point.inPixels // test this with a Retina screen target
// => {x 50 y 25}
let someScreen = UIScreen.screens().last!
let someScreen = UIScreen.screens.last!
point.inPixels(someScreen) // pass a different screen
// => {x 100 y 50}
```
Expand All @@ -282,7 +286,7 @@ Returns a new CGRect object with the origin and size converted to true pixels on
let rect = CGRect(x: 10, y: 20, width: 100, height: 50)
rect.inPixels // test this with a Retina screen target
// => {x 5 y 10 w 50 h 25}
let someScreen = UIScreen.screens().last!
let someScreen = UIScreen.screens.last!
rect.inPixels(someScreen) // pass a different screen
// => {x 10 y 20 w 100 h 50}
```
Expand Down Expand Up @@ -359,8 +363,8 @@ let frequencyTable = FrequencyTable(values: wordFrequencies){ $0.frequency }
Returns a random element with frequency-based probability within the array or nil if array empty.

``` Swift
frequencyTable.sample
let randomWord = frequencyTable.sample.map{ $0.word }
frequencyTable.sample()
let randomWord = frequencyTable.sample().map{ $0.word }
// => "Harry"
```

Expand Down
Loading

0 comments on commit 7e86034

Please sign in to comment.