项目作者: ClintJang

项目描述 :
JWSWebViewSample created sample code for UIWebView and WKWebView with swift and objective-c.
高级语言: Swift
项目地址: git://github.com/ClintJang/JWSWebViewSample.git
创建时间: 2017-12-15T09:26:45Z
项目社区:https://github.com/ClintJang/JWSWebViewSample

开源协议:MIT License

下载


JWSWebViewSample

License Swift 4 objective-c

Requirements

  • Minimum iOS Target : iOS 9.0
  • Minimum Xcode Version : Xcode 9.0
  • This Sample Project : Xcode 9.2
    (Because of “Self Area”)

Description

  • This is the WebView Sample source. Both UIWebView and WKWebView can be checked together.You can also check the Swift source and Objective-C source.

  • This is the default project swift. You can also test with objective-c by adding an objective-c source inside. Public data was managed by appdelegate.swift.

  • It is easy to check the execution result of UIWebView and WKWebView.

  • An example of using objective-c in swift, and an example of using the swift source in objective-c.

Info

Result Image












structure objective-c swift

Source

  • AppDelegate.swift
  1. ...
  2. // Change your test URL here.
  3. private let urlString = "http://www.github.com"
  4. // For convenience, I created it in "appdelegate". This is whether or not "URL" is selected.
  5. @objc var isURL:Bool = false
  6. @objc var url:URL? {
  7. return URL(string: urlString)
  8. }
  9. ...
  • swift
    • WKWebView : SwiftWKWebViewController.swift
    • UIWebView : SwiftUIWebViewController.swift
  • objective-c

    • WKWebView : ObjectiveCWKWebViewViewController.h , .m
    • UIWebView : ObjectiveCUIWebViewViewController.h , .m
  • sample.html

Using Swift And Objective-C together

  • Swift










    Packaging, Defines Module : YES Import “yourprojectname-Swift.h”
  • Objective-C, Bridging Header Setting

Safe Area










iPhone X Sample View 1 iPhone X Sample View 2