This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ExpandableText.swift | |
// | |
// Created by TomQDRS on 06.08.21. | |
// | |
import SwiftUI | |
extension Text { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SETUP REQUIRED: | |
// The setup requires a Storyboard setup with an empty, clear view called `keyboardSpacer`. | |
// That view should be placed below the elements that you want to be pushed up when the keyboard appears. | |
// Give that view a height constraint and connect that constraint to `keyboardSpacerHeightConstraint`. | |
// The static value for that height (thes size when the keyboard isn't shown) should be jotted down in `staticHeightForKeyboardSpacer`. | |
// This can also be simplified by making `staticHeightForKeyboardSpacer` inspectable. | |
// The following functions will change the height constraint of the `keyboardSpacer` view depending on the keyboard status, | |
// making sure that the spacer view will be the same height as the keyboard when it is shown or changed and revert to the original size when it is hidden. |