Skip to content

Commit

Permalink
Add dodge keyboard modifier (apptekstudios#179)
Browse files Browse the repository at this point in the history
* 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 <antonino.musolino@kering.com>
Co-authored-by: Apptek Studios <13492172+apptekstudios@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 15, 2020
1 parent 4550cd5 commit 4d1bb3f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/ASCollectionView/ASCollectionView+Modifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,17 @@ public extension ASCollectionView
func shouldAttemptToMaintainScrollPositionOnOrientationChange(maintainPosition: Bool) -> Self
{
var this = self
this.maintainScrollPositionOnOrientationChange = true
this.maintainScrollPositionOnOrientationChange = maintainPosition
return this
}

/// Set whether the ASCollectionView should scroll the collection view in order to keep the current input field visible when the system keyboard appears.
/// The default value is `true`
func shouldAvoidKeyboard(_ avoidKeyboard: Bool = true) -> Self {
var this = self
this.dodgeKeyboard = avoidKeyboard
return this
}
}

// MARK: PUBLIC layout modifier functions
Expand Down

0 comments on commit 4d1bb3f

Please sign in to comment.