Skip to content
This repository was archived by the owner on Nov 4, 2022. It is now read-only.

Commit 4d1bb3f

Browse files
posix88Antonino Francesco Musolinoapptekstudios
authored
Add dodge keyboard modifier (#179)
* add keyboard avoidance modifier * fix the maintainPosition modifier, that doesn't set the given value * Documentation for avoid keyboard modifier Co-authored-by: Antonino Francesco Musolino <[email protected]> Co-authored-by: Apptek Studios <[email protected]>
1 parent 4550cd5 commit 4d1bb3f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/ASCollectionView/ASCollectionView+Modifiers.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,17 @@ public extension ASCollectionView
129129
func shouldAttemptToMaintainScrollPositionOnOrientationChange(maintainPosition: Bool) -> Self
130130
{
131131
var this = self
132-
this.maintainScrollPositionOnOrientationChange = true
132+
this.maintainScrollPositionOnOrientationChange = maintainPosition
133133
return this
134134
}
135+
136+
/// Set whether the ASCollectionView should scroll the collection view in order to keep the current input field visible when the system keyboard appears.
137+
/// The default value is `true`
138+
func shouldAvoidKeyboard(_ avoidKeyboard: Bool = true) -> Self {
139+
var this = self
140+
this.dodgeKeyboard = avoidKeyboard
141+
return this
142+
}
135143
}
136144

137145
// MARK: PUBLIC layout modifier functions

0 commit comments

Comments
 (0)