-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path1DEE0F27-C0FB-4AAB-8C2C-26667948B460.codesnippet
70 lines (60 loc) · 2.1 KB
/
1DEE0F27-C0FB-4AAB-8C2C-26667948B460.codesnippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>my_uikit2swiftUI_swiftUI_block</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>All</string>
</array>
<key>IDECodeSnippetContents</key>
<string>
//VC的转换
struct ContentView: View {
var body: some View {
HtmlLabelViewControllerRepresentable()
.edgesIgnoringSafeArea(.all)
}
}
struct HtmlLabelViewControllerRepresentable: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> HtmlLabelViewController {
return HtmlLabelViewController() // 创建并返回你的 UIViewController
}
func updateUIViewController(_ uiViewController: HtmlLabelViewController, context: Context) {
// 在这里更新 UIViewController(如果需要)
}
}
//View的转换
struct MapView: UIViewRepresentable {
let landmark: Landmark
func makeUIView(context: Context) -> MKMapView {
return MKMapView()
}
func updateUIView(_ uiView: MKMapView, context: Context) {
//地图中心点经纬度
let center = CLLocationCoordinate2DMake(39.9087243, 116.3952859)
//比例尺
let span = MKCoordinateSpan(latitudeDelta: 0.02, longitudeDelta: 0.02)
uiView.setRegion(MKCoordinateRegion(center: landmark.locationCoordition, span: span), animated: true)
}
}
struct MapView_Previews: PreviewProvider {
static var previews: some View {
MapView(landmark: landmarks[0])
}
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>1DEE0F27-C0FB-4AAB-8C2C-26667948B460</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Generic</string>
<key>IDECodeSnippetSummary</key>
<string>uikit转换成swiftUI</string>
<key>IDECodeSnippetTitle</key>
<string>my_uikit2swiftUI_swiftUI_block</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>