diff --git a/.swift-version b/.swift-version new file mode 100755 index 0000000..8012ebb --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +4.2 \ No newline at end of file diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..44d0c1f --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,11 @@ +included: + - Sources + - Tests + +disabled_rules: + - identifier_name + - type_name + - cyclomatic_complexity + - file_length + +line_length: 200 diff --git a/Arrows.xcodeproj/project.pbxproj b/Arrows.xcodeproj/project.pbxproj index 8da580f..c7042ee 100644 --- a/Arrows.xcodeproj/project.pbxproj +++ b/Arrows.xcodeproj/project.pbxproj @@ -13,9 +13,7 @@ /* Begin PBXFileReference section */ 52D6D97C1BEFF229002C0205 /* Arrows.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Arrows.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52D6D9F01BEFFFBE002C0205 /* Arrows.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Arrows.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 8933C7891EB5B82A000D00A4 /* ArrowsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrowsTests.swift; sourceTree = ""; }; AD2FAA261CD0B6D800659CF4 /* Arrows.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Arrows.plist; sourceTree = ""; }; - AD2FAA281CD0B6E100659CF4 /* ArrowsTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ArrowsTests.plist; sourceTree = ""; }; C48D94EF21733452008A498D /* ArrowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrowView.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -41,7 +39,6 @@ isa = PBXGroup; children = ( 8933C7811EB5B7E0000D00A4 /* Sources */, - 8933C7831EB5B7EB000D00A4 /* Tests */, 52D6D99C1BEFF38C002C0205 /* Configs */, 52D6D97D1BEFF229002C0205 /* Products */, ); @@ -60,7 +57,6 @@ isa = PBXGroup; children = ( DD7502721C68FC1B006590AF /* Frameworks */, - DD7502731C68FC20006590AF /* Tests */, ); path = Configs; sourceTree = ""; @@ -73,15 +69,6 @@ path = Sources; sourceTree = ""; }; - 8933C7831EB5B7EB000D00A4 /* Tests */ = { - isa = PBXGroup; - children = ( - 8933C7891EB5B82A000D00A4 /* ArrowsTests.swift */, - ); - name = Tests; - path = Tests/ArrowsTests; - sourceTree = ""; - }; DD7502721C68FC1B006590AF /* Frameworks */ = { isa = PBXGroup; children = ( @@ -90,14 +77,6 @@ name = Frameworks; sourceTree = ""; }; - DD7502731C68FC20006590AF /* Tests */ = { - isa = PBXGroup; - children = ( - AD2FAA281CD0B6E100659CF4 /* ArrowsTests.plist */, - ); - name = Tests; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ diff --git a/Configs/ArrowsTests.plist b/Configs/ArrowsTests.plist deleted file mode 100644 index ba72822..0000000 --- a/Configs/ArrowsTests.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/README.md b/README.md index 569aad1..eff7bdc 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,20 @@ class YourViewController: UIViewController { The perfect companion for `Arrows` is [Panels](https://github.com/antoniocasero/Panels), take a look! +## More options + +```swift + /// Get the current position, if you want to change + /// position use `update` function + fileprivate(set) var arrowPosition: Position = .middle + + /// Animation duration between arrow states (accesible from IB) + @IBInspectable open var arrowAnimationDuration: Double = 0.30 + + /// Set arrow color (accesible from IB) + @IBInspectable open var arrowColor: UIColor = .black +``` +

Arrowa demo1

@@ -47,7 +61,7 @@ The perfect companion for `Arrows` is [Panels](https://github.com/antoniocasero/ Add the line `pod "Arrows"` to your `Podfile` ### Carthage -Add the line `github "antoniocasero/Arrowa"` to your `Cartfile` +Add the line `github "antoniocasero/Arrows"` to your `Cartfile` ## Author Project created by Antonio Casero ([@acaserop](https://twitter.com/acaserop) on Twitter). diff --git a/Sources/ArrowView.swift b/Sources/ArrowView.swift index eff81c7..39e2bdb 100644 --- a/Sources/ArrowView.swift +++ b/Sources/ArrowView.swift @@ -14,14 +14,16 @@ open class ArrowView: UIView { /// Get the current position, if you want to change /// position use `update` function fileprivate(set) var arrowPosition: Position = .middle - @IBInspectable var arrowColor: UIColor = .black { + + /// Set arrow color + @IBInspectable open var arrowColor: UIColor = .black { didSet { arrowLayer.fillColor = arrowColor.cgColor } } /// Animation duration between arrow states - open var arrowAnimationDuration: Double = 0.30 + @IBInspectable open var arrowAnimationDuration: Double = 0.30 /// Arrow positions /// @@ -81,7 +83,7 @@ open class ArrowView: UIView { } extension ArrowView { - private func commonInit(){ + private func commonInit() { layer.frame = self.bounds backgroundColor = .clear update(to: arrowPosition, animated: false) @@ -111,7 +113,6 @@ extension ArrowView { controlPoint1: CGPoint(x: arrowFrame.minX + 0.86212 * frame.width, y: arrowFrame.minY + 0.48781 * arrowFrame.height), controlPoint2: CGPoint(x: arrowFrame.minX + 0.85246 * frame.width, y: arrowFrame.minY + 0.45044 * arrowFrame.height)) - bezierPath.close() bezierPath.miterLimit = 4 return bezierPath diff --git a/Tests/ArrowsTests/ArrowsTests.swift b/Tests/ArrowsTests/ArrowsTests.swift deleted file mode 100644 index 92d5374..0000000 --- a/Tests/ArrowsTests/ArrowsTests.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ArrowsTests.swift -// Arrows -// -// Created by Antonio Casero Palmero on 10.10.18. -// Copyright © 2018 Arrows. All rights reserved. -// - -import Foundation -import XCTest -import Arrows - -class ArrowsTests: XCTestCase { - func testExample() { - } - static var allTests = [ - ("testExample", testExample), - ] -} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 58959e3..7b54c94 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -2,5 +2,5 @@ import XCTest @testable import ArrowsTests XCTMain([ - testCase(ArrowsTests.allTests), + testCase(ArrowsTests.allTests) ])