I have textfield, and I need to change text in textfield using static function.
import SwiftUI
struct MainScreen: View
{
@State static var mytext = "TEXT"
var body: some View
{
Text(MainScreen.mytext)
}
public static func showtext(newtext: String)
{
MainScreen.mytext = newtext
}
}
How can I do it? Or how can I get MainScreen.self in static function, if I will use @State var mytext = "TEXT"?
P.S.: sorry for my English)))