Skip to content

Commit

Permalink
Merge pull request #9 from faberNovel/add_autocorrection_param
Browse files Browse the repository at this point in the history
Add autocorrection param
  • Loading branch information
Samuel Gallet authored Jan 4, 2022
2 parents 2eed99a + 39cee5c commit bc8d7b8
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ADFormController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ADFormController'
spec.version = '6.0.5'
spec.version = '6.0.6'
spec.authors = 'Applidium'
spec.license = 'none'
spec.homepage = 'http://applidium.com'
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
`ADFormController` adheres to [Semantic Versioning](http://semver.org/).

## [6.0.6]

### Fix
- Make autocorrection configurable

## [6.0.5]

### Fix
Expand Down
1 change: 1 addition & 0 deletions FormDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@
"${BUILT_PRODUCTS_DIR}/Nimble-Snapshots/Nimble_Snapshots.framework",
"${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
"${BUILT_PRODUCTS_DIR}/iOSSnapshotTestCase/FBSnapshotTestCase.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down
12 changes: 12 additions & 0 deletions Modules/ADFormController/Classes/FormCellTextConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import UIKit
open var returnAction: (() -> Bool)?
open var textInputAccessibilityIdentifier: String?
open var clearButtonMode: UITextField.ViewMode = .never
open lazy var autocorrectionType: UITextAutocorrectionType = createDefaultAutoCorrectionType()

override public init() {
super.init()
Expand All @@ -60,4 +61,15 @@ import UIKit
let cell = configurable.textInputCell(with: self, at: indexPath)
return cell
}

// MARK: - Private

private func createDefaultAutoCorrectionType() -> UITextAutocorrectionType {
switch cellType {
case .email, .password, .name, .phone, .date, .time, .picker, .passwordNumber:
return .no
case .text, .number, .decimal, .longText:
return .default
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class FormTextFieldTableViewCell : FormBaseTableViewCell, UITextFieldDelegate, F
case .email:
textField.keyboardType = .emailAddress
textField.autocapitalizationType = .none
textField.autocorrectionType = .no
case .password:
textField.isSecureTextEntry = true
case .passwordNumber:
Expand All @@ -33,13 +32,11 @@ class FormTextFieldTableViewCell : FormBaseTableViewCell, UITextFieldDelegate, F
case .name:
textField.keyboardType = .default
textField.autocapitalizationType = .words
textField.autocorrectionType = .no
case .phone:
textField.keyboardType = .phonePad
case .text:
textField.keyboardType = .default
textField.autocapitalizationType = .sentences
textField.autocorrectionType = .default
case .number:
textField.keyboardType = .numberPad
case .decimal:
Expand Down Expand Up @@ -174,6 +171,7 @@ class FormTextFieldTableViewCell : FormBaseTableViewCell, UITextFieldDelegate, F
textField.accessibilityIdentifier = configuration.textInputAccessibilityIdentifier
textField.clearButtonMode = configuration.clearButtonMode
hideRightViewWhenEditing = configuration.hideRightViewWhenEditing
textField.autocorrectionType = configuration.autocorrectionType

if let separatorInset = configuration.separatorInset {
self.separatorInset = separatorInset
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ abstract_target 'Form' do

target 'FormDemoTests' do
pod 'Quick', '~> 2.1'
pod 'Nimble', '~> 8.0'
pod 'Nimble-Snapshots', '~> 4.3.0'
pod 'Nimble', '~> 9.2'
pod 'Nimble-Snapshots', '~> 9.3'
pod 'OCMock', '~> 3.3'
pod 'FBSnapshotTestCase', '~> 2.1'
end
Expand Down
32 changes: 19 additions & 13 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- ADFormController (6.0.5):
- ADFormController (6.0.6):
- ADKeyboardManager (~> 6.0)
- ADKeyboardManager (6.0.0)
- ADUtils (10.5.0):
Expand All @@ -16,13 +16,17 @@ PODS:
- FBSnapshotTestCase/Core (2.1.4)
- FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core
- Nimble (8.1.2)
- Nimble-Snapshots (4.3.0):
- Nimble-Snapshots/Core (= 4.3.0)
- Nimble-Snapshots/Core (4.3.0):
- FBSnapshotTestCase (~> 2.0)
- iOSSnapshotTestCase (8.0.0):
- iOSSnapshotTestCase/SwiftSupport (= 8.0.0)
- iOSSnapshotTestCase/Core (8.0.0)
- iOSSnapshotTestCase/SwiftSupport (8.0.0):
- iOSSnapshotTestCase/Core
- Nimble (9.2.1)
- Nimble-Snapshots (9.3.0):
- Nimble-Snapshots/Core (= 9.3.0)
- Nimble-Snapshots/Core (9.3.0):
- iOSSnapshotTestCase (~> 8.0)
- Nimble
- Quick
- OCMock (3.8.1)
- Quick (2.2.1)
- Watchdog (4.0)
Expand All @@ -33,8 +37,8 @@ DEPENDENCIES:
- Alamofire (~> 4.8)
- CocoaLumberjack/Swift (~> 3.5)
- FBSnapshotTestCase (~> 2.1)
- Nimble (~> 8.0)
- Nimble-Snapshots (~> 4.3.0)
- Nimble (~> 9.2)
- Nimble-Snapshots (~> 9.3)
- OCMock (~> 3.3)
- Quick (~> 2.1)
- Watchdog (~> 4.0)
Expand All @@ -46,6 +50,7 @@ SPEC REPOS:
- Alamofire
- CocoaLumberjack
- FBSnapshotTestCase
- iOSSnapshotTestCase
- Nimble
- Nimble-Snapshots
- OCMock
Expand All @@ -57,18 +62,19 @@ EXTERNAL SOURCES:
:path: "./"

SPEC CHECKSUMS:
ADFormController: 94683926ca258f47805cee9a0f29a8f95a919f0a
ADFormController: 93695de5dac8589ecb508bb82ef9f8f901789ffc
ADKeyboardManager: a9dce48b8d2306c1fca5deb46d04fa8472516fe2
ADUtils: 67372e355673bbc53f6843423dc78ebf3771f8ec
Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
CocoaLumberjack: e8955b9d337ac307103b0a34fd141c32f27e53c5
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
Nimble: 3864815b4703c7ebffba875973c70e854489fbae
Nimble-Snapshots: 4ba722c35b73a680cbd856e4bc22076dfb8085d4
iOSSnapshotTestCase: a670511f9ee3829c2b9c23e6e68f315fd7b6790f
Nimble: e7e615c0335ee4bf5b0d786685451e62746117d5
Nimble-Snapshots: 97270cd48f0e6eebd6c80ccf7dd35d4e57fb9997
OCMock: 29f6e52085b4e7d9b075cbf03ed7c3112f82f934
Quick: f5754d69b7013f5864c29aab9ae6f0c79c5bc200
Watchdog: 370d2c2a58c9bede0e3f9b8cc26bf297745c31c2

PODFILE CHECKSUM: cde55cffb8e485ca348a8af64bd4a55211c4b9d9
PODFILE CHECKSUM: 58e58508f61477761c3993c57deacd70a616450f

COCOAPODS: 1.10.0

0 comments on commit bc8d7b8

Please sign in to comment.