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 | |
import SwiftData | |
import UIKit | |
@Model | |
class Item { | |
var 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
import SwiftUI | |
import UIKit | |
struct TextInputView: View { | |
@State private var textFieldText = "" | |
var body: some View { | |
TextField("Type here", text: $textFieldText) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
.padding() |
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
// Modified version of the extension found in https://github.com/FlexMonkey/Blurable | |
extension UIView { | |
func asImage() -> UIImage { | |
let format = UIGraphicsImageRendererFormat() | |
format.scale = 1.0 | |
let renderer = UIGraphicsImageRenderer(size: bounds.size, format: format) | |
return renderer.image { ctx in | |
layer.render(in: ctx.cgContext) | |
} |