Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Gnidets committed Apr 5, 2020
2 parents 3dc14fb + eb46942 commit c1f2f73
Show file tree
Hide file tree
Showing 17 changed files with 457 additions and 112 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DerivedData/
*.perspectivev3
!default.perspectivev3
xcuserdata/
.DS_Store

## Other
*.moved-aside
Expand Down
115 changes: 114 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,117 @@ type_name:
identifier_name:
min_length: 2

reporter: "xcode"
opt_in_rules:
- conditional_returns_on_newline
- trailing_newline
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- fatal_error_message
- first_where
- unused_declaration
- unused_import
- force_cast
- implicitly_unwrapped_optional
- multiline_parameters
- operator_usage_whitespace
- overridden_super_call
- private_outlet
- private_action
- number_separator
- protocol_property_accessors_order
- redundant_nil_coalescing
- sorted_imports
- duplicate_imports
- syntactic_sugar
- vertical_whitespace
- toggle_bool
- empty_string
- identical_operands
- fallthrough
- yoda_condition
- implicit_return
- mark
- convenience_type
- modifier_order
- unneeded_parentheses_in_closure_argument

disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- closure_end_indentation

conditional_returns_on_newline:
severity: error

implicitly_unwrapped_optional:
mode: all_except_iboutlets

large_tuple:
warning: 3
error: 4

trailing_comma:
mandatory_comma: false

number_separator:
minimum_length: 8

private_outlet:
allow_private_set: true

colon:
severity: error
comma: error
empty_count: error
legacy_constant: error
legacy_constructor: error
opening_brace: error
trailing_newline: error
trailing_semicolon: error
weak_delegate: error
class_delegate_protocol: error
mark: error
unneeded_break_in_switch: error
force_unwrapping: error

custom_rules:
explicit_failure_call:
name: "Avoid asserting 'false'"
regex: '(assert\(.*\)|preconditionFailure\(.*\)|assertionFailure\(.*\)|precondition\(.*\))'
message: Use `Debug.reasonedFailure` or `Debug.failure` instead.
severity: warning
multiple_empty_lines:
name: "Multiple Empty Lines"
regex: '((?:\s*\n){3,})'
message: "There are too many line breaks"
severity: error
comments_space:
name: "Space After Comment"
regex: '(^ *//\w+)'
message: "There should be a space after //"
severity: error
empty_first_line:
name: "Empty First Line"
regex: '(^[ a-zA-Z ]*(?:protocol|extension|class|struct|enum) (?!(?:var|let))[ a-zA-Z:]*\{\n *\S+)'
message: "There should be an empty line after a declaration"
severity: error
double_space:
include: "*.swift"
name: "Double space are disabled"
regex: '([a-z,A-Z] \s+)'
message: "Double space between keywords"
match_kinds: keyword
severity: error
empty_line_after_super:
name: "Empty Line After Super"
regex: '(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)'
message: "There should be an empty line after super"
severity: error
avoid_not_english_names:
name: "Can't contain cyrylic letters: а-я А-Я"
regex: '[а-яА-ЯёЁ]'
message: "Name shouldn't contains cyrylic letters"
severity: error

reporter: "xcode"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2018 Oleg Hnidets
Copyright (c) 2017-2020 Oleg Hnidets

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
41 changes: 41 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// swift-tools-version:5.1
//
// Package.swift
//
// Copyright (c) 2017-2020 Oleg Hnidets
//
// 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.

import PackageDescription

let package = Package(
name: "TweeTextField",
platforms: [
.iOS(.v10)
],
products: [
.library(name: "TweeTextField", targets: ["TweeTextField"])
],
dependencies: [
],
targets: [
.target(name: "TweeTextField", path: "Sources")
],
swiftLanguageVersions: [.v5]
)
24 changes: 21 additions & 3 deletions Sources/FontAnimation.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
// Created by Oleg Hnidets on 12/20/17.
// Copyright © 2017-2019 Oleg Hnidets. All rights reserved.
//
// Copyright (c) 2017-2020 Oleg Hnidets
//
// 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.
//

import CoreFoundation
import Foundation
import QuartzCore
import CoreFoundation

internal final class FontAnimation {

Expand Down
49 changes: 34 additions & 15 deletions Sources/TweeActiveTextField.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
// Created by Oleg Hnidets on 12/20/17.
// Copyright © 2017-2019 Oleg Hnidets. All rights reserved.
//
// Copyright (c) 2017-2020 Oleg Hnidets
//
// 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.
//

import UIKit
import QuartzCore
import UIKit

/// An object of the class can show animated bottom line when a user begins editing.
open class TweeActiveTextField: TweeBorderedTextField {

enum Settings {
internal enum Settings {

enum Animation {

enum Key {

static let activeStart = "ActiveLineStartAnimation"
static let activeEnd = "ActiveLineEndAnimation"
}
}
}

private var activeLine = Line()

/// Color of line that appears when a user begins editing.
@IBInspectable public var activeLineColor: UIColor {
Expand All @@ -44,26 +65,24 @@ open class TweeActiveTextField: TweeBorderedTextField {
/// Width of line that appears when a user begins editing.
@IBInspectable public var animationDuration: Double = 1

private var activeLine = Line()

// MARK: Methods

/// :nodoc:
public override init(frame: CGRect) {
super.init(frame: frame)

initializeSetup()
}
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

initializeSetup()
}

/// :nodoc:
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
override public init(frame: CGRect) {
super.init(frame: frame)

initializeSetup()
}

/// :nodoc:
open override func layoutSubviews() {
override open func layoutSubviews() {
super.layoutSubviews()

if isEditing {
Expand Down
24 changes: 21 additions & 3 deletions Sources/TweeAttributedTextField.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
// Created by Oleg Hnidets on 12/12/17.
// Copyright © 2017-2019 Oleg Hnidets. All rights reserved.
//
// Copyright (c) 2017-2020 Oleg Hnidets
//
// 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.
//

import UIKit
Expand Down Expand Up @@ -35,7 +53,7 @@ open class TweeAttributedTextField: TweeActiveTextField {
// MARK: Methods

/// :nodoc:
public override init(frame: CGRect) {
override public init(frame: CGRect) {
super.init(frame: frame)

initializeSetup()
Expand Down
28 changes: 24 additions & 4 deletions Sources/TweeBorderedTextField.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
// Created by Oleg Hnidets on 12/20/17.
// Copyright © 2017-2019 Oleg Hnidets. All rights reserved.
//
// Copyright (c) 2017-2020 Oleg Hnidets
//
// 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.
//

import UIKit

/// Represents a line containing path and layer.
internal class Line {

var path = UIBezierPath()
var layer = CAShapeLayer()
}

/// Сustom offset of bottom line.
/// Custom offset of bottom line.
public struct BorderOffset {

let x: CGFloat // swiftlint:disable:this identifier_name
let y: CGFloat // swiftlint:disable:this identifier_name
}
Expand Down Expand Up @@ -49,7 +69,7 @@ open class TweeBorderedTextField: TweePlaceholderTextField {
// MARK: Methods

/// :nodoc:
public override init(frame: CGRect) {
override public init(frame: CGRect) {
super.init(frame: frame)

initializeSetup()
Expand Down
Loading

0 comments on commit c1f2f73

Please sign in to comment.