Files
divkit/client/ios/Samples/SwiftUIIntegration/DivKitSample/ContentView.swift
T
booster b489b36d92 Fixed file path in precommit hook
commit_hash:f7df7bc7f68f49dd4b005691712d8784e092107e
2025-07-17 17:28:31 +03:00

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()
}