https://github.com/clintjang/jwswebviewsample
JWSWebViewSample created sample code for UIWebView and WKWebView with swift and objective-c.
https://github.com/clintjang/jwswebviewsample
appdelegate swift swift-source uiwebview wkwebview
Last synced: 3 months ago
JSON representation
JWSWebViewSample created sample code for UIWebView and WKWebView with swift and objective-c.
- Host: GitHub
- URL: https://github.com/clintjang/jwswebviewsample
- Owner: ClintJang
- License: mit
- Created: 2017-12-15T09:26:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T09:22:46.000Z (over 7 years ago)
- Last Synced: 2025-04-14T15:10:06.144Z (6 months ago)
- Topics: appdelegate, swift, swift-source, uiwebview, wkwebview
- Language: Swift
- Size: 4.39 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JWSWebViewSample
[](https://github.com/clintjang/JWSBoltsSwiftSample/blob/master/LICENSE) [](https://swift.org) [](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html)- Link 1-En (Good): [WKWebView: Differences from UIWebView browsing engine](http://docs.kioskproapp.com/article/840-wkwebview-supported-features-known-issues#requires-ios9)
- Link 1-Ko (Good): [UIWebView와 WKWebView의 차이](http://zeddios.tistory.com/332)
- Link 2: [What's the difference between UIWebView and WKWebView?](https://www.hackingwithswift.com/example-code/wkwebview/whats-the-difference-between-uiwebview-and-wkwebview)## 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```swift
...
// Change your test URL here.
private let urlString = "http://www.github.com"// For convenience, I created it in "appdelegate". This is whether or not "URL" is selected.
@objc var isURL:Bool = false
@objc var url:URL? {
return URL(string: urlString)
}
...
```- swift
- WKWebView : SwiftWKWebViewController.swift
- UIWebView : SwiftUIWebViewController.swift
- objective-c
- WKWebView : ObjectiveCWKWebViewViewController.h , .m
- UIWebView : ObjectiveCUIWebViewViewController.h , .m- sample.html
![]()
## Apple Link
- WKWebView : https://developer.apple.com/documentation/webkit/wkwebview
- UIWebView : https://developer.apple.com/documentation/uikit/uiwebview## Using Swift And Objective-C together
- Swift
Packaging, Defines Module : YES
Import "yourprojectname-Swift.h"
![]()
![]()
- Objective-C, Bridging Header Setting
## Safe Area
- Also available on iPhone X
- https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area
iPhone X Sample View 1
iPhone X Sample View 2
![]()
![]()