일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 러닝기록앱
- weak var
- swift
- Timer
- 영문 개인정보처리방침
- UIAlertAction
- 클로저의 캡슐화
- 단일 책임원칙
- UICollectionViewFlowLayout
- Startign Assignments
- 러닝타이머
- App Store Connect
- WeatherManager
- Protocol
- addannotation
- font book
- dispatchsource
- CoreLocation
- 한국어 개인정보처리방침
- SwiftUI Boolean 값
- weatherKit
- MKMapItem
- CLLocationManagerDelegate
- MKMapViewDelegate
- AnyObject
- 서체관리자
- Required Reason API
- RunningTimer
- xcode로 날씨앱 만들기
- Xcode
- Today
- Total
VesselWheel
[SwiftUI] webview 사용 코드 본문
Type 'VideoView' does not conform to protocol 'UIViewRepresentable'
I'm trying to embed a YouTube video into my app and keep getting this error Type 'VideoView' does not conform to protocol 'UIViewRepresentable' here's my code: import SwiftUI import WebKit struct
stackoverflow.com
import SwiftUI
import WebKit
struct MyWebView: UIViewRepresentable {
var urlToLoard: String
func makeUIView(context: Context) -> WKWebView {
guard let url = URL(string: self.urlToLoard)
else {
return WKWebView()
}
let webView = WKWebView()
webView.load(URLRequest(url: url))
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
guard let baikURL = URL(string: "https://paikdabang.com/store") else {return}
uiView.scrollView.isScrollEnabled = false
uiView.load(URLRequest(url: baikURL))
}
}
struct MyWebView_Previews: PreviewProvider {
static var previews: some View {
MyWebView(urlToLoard:"")
}
}
'Xcode Study' 카테고리의 다른 글
Guard 문의 개념 (0) | 2023.04.30 |
---|---|
[SwiftUI] Allow Arbitrary Loads, 외부 URL 허용 (0) | 2023.04.29 |
[SwiftUI] cocoapods 설치 및 사용 (0) | 2023.04.29 |
[SwiftUI]switch 문의 개념 (0) | 2023.04.26 |
[SwiftUI]if 문의 개념 (0) | 2023.04.26 |