Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 95 additions & 2 deletions Pod/PinCodeTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,93 @@
import Foundation
import UIKit

@IBDesignable open class PinCodeTextField: UIView {
@IBDesignable open class PinCodeTextField: UIView, UITextInput {
public func replace(_ range: UITextRange, withText text: String) {
}

public var selectedTextRange: UITextRange? = nil

public var markedTextRange: UITextRange? = nil

public var markedTextStyle: [AnyHashable : Any]? = nil

public func setMarkedText(_ markedText: String?, selectedRange: NSRange) {
}

public func unmarkText() {
}

public var beginningOfDocument: UITextPosition = UITextPosition()

public var endOfDocument: UITextPosition = UITextPosition()

public func textRange(from fromPosition: UITextPosition, to toPosition: UITextPosition) -> UITextRange? {
return nil
}

public func position(from position: UITextPosition, offset: Int) -> UITextPosition? {
return nil
}

public func position(from position: UITextPosition, in direction: UITextLayoutDirection, offset: Int) -> UITextPosition? {
return nil
}

public func compare(_ position: UITextPosition, to other: UITextPosition) -> ComparisonResult {
return ComparisonResult.orderedSame
}

public func offset(from: UITextPosition, to toPosition: UITextPosition) -> Int {
return 0
}

public var inputDelegate: UITextInputDelegate?

public var tokenizer: UITextInputTokenizer = UITextInputStringTokenizer()

public func position(within range: UITextRange, farthestIn direction: UITextLayoutDirection) -> UITextPosition? {
return nil
}

public func characterRange(byExtending position: UITextPosition, in direction: UITextLayoutDirection) -> UITextRange? {
return nil
}

public func baseWritingDirection(for position: UITextPosition, in direction: UITextStorageDirection) -> UITextWritingDirection {
return UITextWritingDirection.natural
}

public func setBaseWritingDirection(_ writingDirection: UITextWritingDirection, for range: UITextRange) {
}

public func firstRect(for range: UITextRange) -> CGRect {
return CGRect.zero
}

public func caretRect(for position: UITextPosition) -> CGRect {
return CGRect.zero
}

public func selectionRects(for range: UITextRange) -> [Any] {
return []
}

public func closestPosition(to point: CGPoint) -> UITextPosition? {
return nil
}

public func closestPosition(to point: CGPoint, within range: UITextRange) -> UITextPosition? {
return nil
}

public func characterRange(at point: CGPoint) -> UITextRange? {
return nil
}

public func text(in range: UITextRange) -> String? {
return nil
}

public weak var delegate: PinCodeTextFieldDelegate?

//MARK: Customizable from Interface Builder
Expand Down Expand Up @@ -52,7 +138,14 @@ import UIKit
public var autocorrectionType: UITextAutocorrectionType = UITextAutocorrectionType.no
public var font: UIFont = UIFont.systemFont(ofSize: 14)
public var allowedCharacterSet: CharacterSet = CharacterSet.alphanumerics
public var textContentType: UITextContentType! = nil

public lazy var textContentType: UITextContentType! = {
guard #available(iOS 12.0, *) else {
return nil
}

return UITextContentType.oneTimeCode
}()

private var _inputView: UIView?
open override var inputView: UIView? {
Expand Down