| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- Protocol
- MKMapViewDelegate
- RunningTimer
- SwiftUI Boolean 값
- 러닝타이머
- Timer
- Startign Assignments
- 단일 책임원칙
- addannotation
- UICollectionViewFlowLayout
- weak var
- 한국어 개인정보처리방침
- font book
- 러닝기록앱
- MKMapItem
- WeatherManager
- Xcode
- Required Reason API
- weatherKit
- xcode로 날씨앱 만들기
- 클로저의 캡슐화
- 서체관리자
- App Store Connect
- swift
- dispatchsource
- CLLocationManagerDelegate
- CoreLocation
- AnyObject
- UIAlertAction
- 영문 개인정보처리방침
- 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 |