Swift UIKit (5) - 웹 뷰 구현 (Web View)

soy·2023년 12월 3일
0

iOS-UIKit

목록 보기
13/22

Webview

내가 작성한 코드

//
//  ViewController.swift
//  WebViewMission
//
//  Created by seohuibaek on 2022/10/06.
//

import UIKit
import WebKit

class ViewController: UIViewController{

    @IBOutlet var myWebView: WKWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

        let filePath = Bundle.main.path(forResource: "htmlView", ofType: "html")
        let myURL = URL(fileURLWithPath: filePath!)
        let myRequest = URLRequest(url: myURL)
        
        myWebView.load(myRequest)
    }
}

html 코드

<html>
    <head>
        <meta charset="utf-8">
            </head>
    <body>
        <h1> WorkFlowy </h1>
        workflowy앱처럼 보이는지 확인해 봅시다<br/>
        <p><a href="https://workflowy.com">https://workflowy.com</a>로 이동</p>
    </body>
</html>

실행화면

피드백

1) 코드 무난히 작성
2) 추가 구현 기능으로 뭐가 좋을지 고민해내지 못함 -> 구현하라는 기능만 정직하게 구현

profile
soysoisoyysauce~

0개의 댓글