Skip to content

Commit

Permalink
Merge branch 'deploy/3.7.0' into productive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Jan 20, 2017
2 parents f86820f + c478bbe commit 9bc3261
Show file tree
Hide file tree
Showing 37 changed files with 356 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
<dict>
<key>baselineAverage</key>
<real>1.45</real>
<real>1.609</real>
<key>baselineIntegrationDisplayName</key>
<string>Local Baseline</string>
<key>maxPercentRelativeStandardDeviation</key>
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ github "Dschee/CommandLine" "5a87809cae05941cb996ce925f885e7a60602dcc"
github "Dschee/Polyglot" "df05686560c1943eb7175921a697cb65852aaeaf"

# Handy Swift features that didn't make it into the Swift standard library.
github "Flinesoft/Handyswift" ~> 1.3
github "Flinesoft/Handyswift" ~> 1.4
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Dschee/CommandLine" "5a87809cae05941cb996ce925f885e7a60602dcc"
github "Flinesoft/Handyswift" "1.3.2"
github "Flinesoft/Handyswift" "1.4.1"
github "Dschee/Polyglot" "df05686560c1943eb7175921a697cb65852aaeaf"
1 change: 1 addition & 0 deletions Carthage/Checkouts/Handyswift/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ disabled_rules:

included:
- Sources
- Tests

excluded:
- Carthage
Expand Down
4 changes: 2 additions & 2 deletions Carthage/Checkouts/Handyswift/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.3.1"
s.version = "1.4.1"
s.summary = "Handy Swift features that didn't make it into the Swift standard library"

s.description = <<-DESC
Expand All @@ -20,7 +20,7 @@ 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.3.1" }
s.source = { :git => "https://github.com/Flinesoft/HandySwift.git", :tag => "1.4.1" }
s.source_files = "Sources", "Sources/**/*.swift"
s.framework = "Foundation"
s.osx.framework = "AppKit"
Expand Down
30 changes: 20 additions & 10 deletions Carthage/Checkouts/Handyswift/HandySwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
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>"; };
A19DD6921DE2B70F00C66584 /* HandySwift.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = HandySwift.podspec; sourceTree = "<group>"; };
A1F5AEEB1E05702E003D6949 /* .swift-version */ = {isa = PBXFileReference; lastKnownFileType = text; path = ".swift-version"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -195,10 +196,7 @@
823B2B271C24AAB6007B3CDD = {
isa = PBXGroup;
children = (
A16B85EB1D8EA9A200B39055 /* README.md */,
82F967F31C67A65E0003F12A /* .swiftlint.yml */,
82F22E551C26434900E784A2 /* Package.swift */,
A19DD6921DE2B70F00C66584 /* HandySwift.podspec */,
A1F5AEEA1E05700F003D6949 /* Root Files */,
825EFDE11C3333CE00558497 /* Sources */,
825EFDE21C3333D200558497 /* Tests */,
823B2B321C24AAB6007B3CDD /* Products */,
Expand Down Expand Up @@ -305,6 +303,18 @@
path = "Supporting Files";
sourceTree = "<group>";
};
A1F5AEEA1E05700F003D6949 /* Root Files */ = {
isa = PBXGroup;
children = (
A16B85EB1D8EA9A200B39055 /* README.md */,
82F967F31C67A65E0003F12A /* .swiftlint.yml */,
82F22E551C26434900E784A2 /* Package.swift */,
A19DD6921DE2B70F00C66584 /* HandySwift.podspec */,
A1F5AEEB1E05702E003D6949 /* .swift-version */,
);
name = "Root Files";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -458,27 +468,27 @@
TargetAttributes = {
823B2B301C24AAB6007B3CDD = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
823B2B3A1C24AAB7007B3CDD = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
825EFDC91C3333B000558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
825EFDD21C3333B000558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
825EFDE81C33351200558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
825EFDF11C33351300558497 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0820;
};
};
};
Expand Down
22 changes: 16 additions & 6 deletions Carthage/Checkouts/Handyswift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
alt="codebeat badge">
</a>
<a href="https://github.com/Flinesoft/HandySwift/releases">
<img src="https://img.shields.io/badge/Version-1.3.1%20|%201.2.0-blue.svg"
alt="Version: 1.3.1 | 1.2.0">
<img src="https://img.shields.io/badge/Version-1.4.1%20|%201.2.0-blue.svg"
alt="Version: 1.4.1 | 1.2.0">
</a>
<img src="https://img.shields.io/badge/Swift-3.0%20|%202.3%20|%202.2-FFAC45.svg"
alt="Swift: 3.0 | 2.3 | 2.2">
Expand Down Expand Up @@ -128,7 +128,7 @@ Int(randomBelow: 1_000_000) // => 208041
Repeat some code block a given number of times.

``` Swift
3.times{ array.append("Hello World!") }
3.times { array.append("Hello World!") }
// => ["Hello World!", "Hello World!", "Hello World!"]

5.times {
Expand All @@ -145,7 +145,7 @@ Repeat some code block a given number of times.
Returns string with whitespace characters stripped from start and end.

``` Swift
" \t BB-8 likes Rey \t ".strip
" \n\t BB-8 likes Rey \t\n ".strip
// => "BB-8 likes Rey"
```

Expand Down Expand Up @@ -191,6 +191,16 @@ Returns an array with `size` random elements or nil if array empty.
([] as [Int]).sample(size: 3) // => nil
```


#### .combinations(with:)

Combines each element with each element of a given other array.

``` Swift
[1, 2, 3].combinations(with: ["A", "B"])
// => [(1, "A"), (1, "B"), (2, "A"), (2, "B"), (3, "A"), (3, "B")]
```

### DictionaryExtension
#### init?(keys:values:)

Expand Down Expand Up @@ -352,7 +362,7 @@ SortedArray(array: [5, 2, 1, 3, 0, 4]).subArray(fromIndex: Array<Int>.Index(2))

### FrequencyTable

#### FrequencyTable(values: valuesArray){ valueToFrequencyClosure }
#### FrequencyTable(values: valuesArray) { valueToFrequencyClosure }

Initialize with values and closure.

Expand All @@ -367,7 +377,7 @@ let wordFrequencies = [
WordFrequency(word: "Ronald", frequency: 1)
]

let frequencyTable = FrequencyTable(values: wordFrequencies){ $0.frequency }
let frequencyTable = FrequencyTable(values: wordFrequencies) { $0.frequency }
// => HandySwift.FrequencyTable<WordFrequency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import Foundation

public extension Array {

/// Returns a random element from the `Array`.
///
/// - Returns: A random element from the array or `nil` if empty.
Expand All @@ -18,7 +17,6 @@ public extension Array {
let randomIndex = startIndex.advanced(by: Int(randomBelow: self.count))
return self[randomIndex]
}

return nil
}

Expand All @@ -28,18 +26,28 @@ public extension Array {
/// - size: The number of random elements wanted.
/// - Returns: An array with the given number of random elements or `nil` if empty.
public func sample(size: Int) -> [Element]? {

if !isEmpty {
var sampleElements: [Element] = []

size.times {
sampleElements.append(self.sample()!)
}

size.times { sampleElements.append(self.sample()!) }
return sampleElements
}

return nil
}

/// Combines each element with each element of a given array.
///
/// Also known as: Cartesian product.
///
/// - Parameters:
/// - other: Other array to combine the elements with.
/// - Returns: An array of tuples with the elements of both arrays combined.
public func combinations<T>(with other: [T]) -> [(Element, T)] {
var combinations = [(Element, T)]()
self.forEach { elem in
other.forEach { otherElem in
combinations.append((elem, otherElem))
}
}
return combinations
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import Foundation

public extension String.CharacterView {

/// Returns a random character from the `ChracterView`.
///
/// - Returns: A random character from the `CharacterView` or `nil` if empty.
Expand All @@ -28,18 +27,11 @@ public extension String.CharacterView {
/// - size: The number of random characters wanted.
/// - Returns: A `CharacterView` with the given number of random characters or `nil` if empty.
public func sample(size: Int) -> String.CharacterView? {

if !isEmpty {
var sampleElements = String.CharacterView()

size.times {
sampleElements.append(sample()!)
}

size.times { sampleElements.append(sample()!) }
return sampleElements
}

return String.CharacterView()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
//

#if !os(OSX)

import UIKit

extension UIColor {

/// A list of changeable attributes of the UIColor.
///
/// - Red: The red color part of RGB & alpha.
Expand All @@ -30,15 +28,13 @@

/// The HSB & alpha attributes of the `UIColor` instance.
public var hsba: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) {

var hsba: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) = (0, 0, 0, 0)
getHue(&(hsba.hue), saturation: &(hsba.saturation), brightness: &(hsba.brightness), alpha: &(hsba.alpha))
return hsba
}

/// The RGB & alpha attributes of the `UIColor` instance.
public var rgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) {

var rgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) = (0, 0, 0, 0)
getRed(&rgba.red, green: &rgba.green, blue: &rgba.blue, alpha: &rgba.alpha)
return rgba
Expand Down Expand Up @@ -77,7 +73,6 @@
case .brightness:
return change(attribute, to: hsba.brightness + addition)
}

}

/// Creates a new `UIColor` object with the value of a single attribute set to a given value.
Expand All @@ -86,8 +81,7 @@
/// - attribute: The attribute to change.
/// - to: The new value to be set for the attribute.
/// - Returns: The resulting new `UIColor` with the specified change applied.
public func change(_ attribute: ChangeableAttribute, to newValue: CGFloat) -> UIColor {

public func change(_ attribute: ChangeableAttribute, to newValue: CGFloat) -> UIColor { // swiftlint:disable:this cyclomatic_complexity
switch attribute {
case .red, .green, .blue, .alpha:
var newRgba = self.rgba
Expand Down Expand Up @@ -129,8 +123,5 @@
return UIColor(hue: newHsba.hue, saturation: newHsba.saturation, brightness: newHsba.brightness, alpha: newHsba.alpha)
}
}

}


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import Foundation

#if !os(OSX)
import UIKit

// MARK: - iOS/tvOS CGSize Extension

extension CGSize {

/// Returns a new CGSize object with the width and height converted to true pixels on the main screen.
public var inPixels: CGSize {
return inPixels(UIScreen.main)
Expand All @@ -27,35 +25,30 @@ import Foundation
public func inPixels(_ screen: UIScreen) -> CGSize {
return CGSize(width: width * screen.scale, height: height * screen.scale)
}

}


// MARK: - iOS/tvOS CGPoint Extension

extension CGPoint {

/// Returns a new CGPoint object with the x and y converted to true pixels on the main screen.
public var inPixels: CGPoint {
return inPixels(UIScreen.main)
}


/// Returns a new CGPoint object with the x and y converted to true pixels on the given screen.
///
/// - Parameters:
/// - screen: The target screen to convert to pixels for.
public func inPixels(_ screen: UIScreen) -> CGPoint {
return CGPoint(x: x * screen.scale, y: y * screen.scale)
}

}


// MARK: - iOS/tvOS CGRect Extension

extension CGRect {

/// Returns a new CGRect object with the origin and size converted to true pixels on the main screen.
public var inPixels: CGRect {
return inPixels(UIScreen.main)
Expand All @@ -68,17 +61,13 @@ import Foundation
public func inPixels(_ screen: UIScreen) -> CGRect {
return CGRect(origin: origin.inPixels(screen), size: size.inPixels(screen))
}

}


#endif


// MARK: - Shared CGRect Extension

extension CGRect {

/// Creates a new CGRect object from origin zero with given size.
///
/// - Parameters:
Expand All @@ -95,5 +84,4 @@ extension CGRect {
public init(width: CGFloat, height: CGFloat) {
self.init(origin: CGPoint.zero, size: CGSize(width: width, height: height))
}

}
Loading

0 comments on commit 9bc3261

Please sign in to comment.