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
| /* | |
| Copied from https://stackoverflow.com/questions/65784294/how-to-detect-if-keyboard-is-present-in-swiftui/76027034#76027034 | |
| Credit to StackOverflow users Confused Vorlon + Lepidopteron | |
| */ | |
| import SwiftUI | |
| import Combine | |
| public extension View { | |
| /// Sets an environment value for keyboardShowing |
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
| import SwiftUI | |
| struct RootView: View { | |
| @State var isExpanded: Bool = false | |
| var body: some View { | |
| Image(systemName: "chevron.right") | |
| .rotationEffect(Angle(degrees: isExpanded ? 90 : 0)) | |
| .onTapGesture { |
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
| import SwiftUI | |
| struct MarkdownText: View { | |
| let text: String | |
| init(_ text: String) { | |
| self.text = 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
| extension Int { | |
| /// Converts total minutes integer to the approximate minute or hours based on duration | |
| public var approximately: String { | |
| let hours = self/60 | |
| let additionalMinutes = self%60 | |
| if additionalMinutes == 0 { | |
| if hours > 1 { | |
| return "$numHours hours".localized(with: ["numHours": hours]) | |
| } |