Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krzyzanowskim/swiftui.textedit
SwiftUI proof-of-concept text edit component
https://github.com/krzyzanowskim/swiftui.textedit
swiftui swiftui-components swiftui-example
Last synced: 3 months ago
JSON representation
SwiftUI proof-of-concept text edit component
- Host: GitHub
- URL: https://github.com/krzyzanowskim/swiftui.textedit
- Owner: krzyzanowskim
- License: bsd-3-clause
- Created: 2021-04-27T20:24:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-22T09:08:46.000Z (over 3 years ago)
- Last Synced: 2024-04-14T07:11:18.931Z (9 months ago)
- Topics: swiftui, swiftui-components, swiftui-example
- Language: Swift
- Homepage: https://swift.best
- Size: 21.5 KB
- Stars: 86
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# SwiftUI TextEdit View
A proof-of-concept text edit component in SwiftUI & CoreText. No UIKit, No AppKit, no UITextView/NSTextView/UITextField involved.
*Note* Due to SwiftUI limitations (as of May 2021) it's not possible to handle keystrokes just with SwiftUI. To overcome this limitation, the `UIKeyboardViewController` is responsible for handling keys and forward to SwiftUI codebase.
If you have questions or want to reach to me, use this thread: https://twitter.com/krzyzanowskim/status/1269402396217745410
## Authors
[Marcin Krzyzanowski](http://krzyzanowskim.com)
[@krzyzanowskim](https://twitter.com/krzyzanowskim)
## Screenshots![TextEdit 2021-05-03 19_00_33](https://user-images.githubusercontent.com/758033/116907452-de751980-ac41-11eb-9595-7a47f1e9a4fe.gif)
## Usage/Examples```swift
struct TextEditingView: View {
@State private var text = "type here...\n"
@State private var font = UIFont.preferredFont(forTextStyle: .body) as CTFont
@State private var carretWidth = 2.0 as CGFloatvar body: some View {
TextEdit(
text: $text,
font: $font,
carretWidth: $carretWidth
)
}
}
```
## FAQ#### How?
CoreText + SwiftUI.
#### Why?
For fun and profit.
## RelatedHere are some related projects
[CoreTextSwift](https://github.com/krzyzanowskim/CoreTextSwift)