Skip to content

Commit 5c512a7

Browse files
committed
Fix issue #7 🐛
1 parent 09a580f commit 5c512a7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

TextFieldCounter.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import UIKit
1111

12-
class TextFieldCounter: UITextField, UITextFieldDelegate {
12+
open class TextFieldCounter: UITextField, UITextFieldDelegate {
1313

1414
lazy private var counterLabel: UILabel = UILabel()
1515

@@ -41,13 +41,13 @@ class TextFieldCounter: UITextField, UITextFieldDelegate {
4141

4242
// MARK: Init
4343

44-
required init?(coder aDecoder: NSCoder) {
44+
required public init?(coder aDecoder: NSCoder) {
4545
super.init(coder: aDecoder)
4646
super.delegate = self
4747
counterLabel = setupCounterLabel()
4848
}
4949

50-
override func draw(_ rect: CGRect) {
50+
override open func draw(_ rect: CGRect) {
5151
super.draw(rect)
5252
rightView = counterLabel
5353
rightViewMode = .whileEditing
@@ -66,7 +66,7 @@ class TextFieldCounter: UITextField, UITextFieldDelegate {
6666
- parameter limitColor: Default color is `UIColor.red`.
6767
*/
6868

69-
init(frame: CGRect, limit: Int, animate: Bool = true, ascending: Bool = true, counterColor: UIColor = .lightGray, limitColor: UIColor = .red) {
69+
public init(frame: CGRect, limit: Int, animate: Bool = true, ascending: Bool = true, counterColor: UIColor = .lightGray, limitColor: UIColor = .red) {
7070

7171
super.init(frame: frame)
7272

@@ -204,7 +204,7 @@ class TextFieldCounter: UITextField, UITextFieldDelegate {
204204

205205
// MARK: UITextFieldDelegate
206206

207-
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
207+
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
208208

209209
var shouldChange = false
210210
let textFieldCharactersCount = getTextFieldCharactersCount(textField: textField, string: string)

0 commit comments

Comments
 (0)