mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
34 lines
771 B
Swift
34 lines
771 B
Swift
import DivKit
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@State private var isPresented: Bool = false
|
|
@State private var text: String = ""
|
|
|
|
var body: some View {
|
|
DivHostingView(
|
|
divkitComponents: DivKitComponents(
|
|
divCustomBlockFactory: SampleDivCustomBlockFactory(),
|
|
urlHandler: SampleDivActionHandler(
|
|
isPresented: $isPresented,
|
|
text: $text
|
|
)
|
|
),
|
|
source: DivViewSource(kind: .data(sampleData), cardId: "Sample"),
|
|
debugParams: DebugParams(isDebugInfoEnabled: true)
|
|
)
|
|
.alert("\(text)", isPresented: $isPresented) {}
|
|
}
|
|
}
|
|
|
|
private let sampleData: Data = try! Data(
|
|
contentsOf: Bundle.main.url(
|
|
forResource: "Sample",
|
|
withExtension: "json"
|
|
)!
|
|
)
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|