https://github.com/allaboutapps/webviewcontroller
https://github.com/allaboutapps/webviewcontroller
id-allaboutapps-ios
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/allaboutapps/webviewcontroller
- Owner: allaboutapps
- License: mit
- Created: 2020-04-15T07:49:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T10:20:07.000Z (about 6 years ago)
- Last Synced: 2025-03-06T16:54:05.729Z (over 1 year ago)
- Topics: id-allaboutapps-ios
- Language: Swift
- Homepage:
- Size: 599 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebViewController
A WebViewController to display external and local content written in swift 5.0.
supported iOS Version +9.0
## Usage
The `WebViewController` needs to be initialized with a `ContentType`.
ContentType can either be an external URL, a local HTML file in the application bundle or an HTML string.
```swift
let url = NSURL(string: "https://apple.com")!
let webView = WebViewController(content: .ExternalURL(url: url)) { controller in
controller.dismissViewControllerAnimated(true, completion: nil)
}
presentViewController(webView, animated: true, completion: nil)
```
### Configuration
The WebViewController can be configured to show progress and a navigation toolbar, as well as adopt to a specific tint color.
```swift
webView.showLoadingProgess = true
webView.showToolBar = true
webView.tintColor = .redColor()
```
### Custom CSS for HTML pages
WebViewController support a custom CSS to style your HTML content.
Call `addCSS:bundle:` to inject a new CSS style.
## App Transport Security (ATS)
### Since iOS 9 HTTPS and TLSv1.2 is required!
> App Transport Security (ATS) lets an app add a declaration to its Info.plist file that specifies the domains with which it needs secure communication. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.
> If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.
> If you want to display websites without https you have to enter the basepath in your ```Info.plist ```
```bash
NSAppTransportSecurity
NSExceptionDomains
yourserver.com
NSIncludesSubdomains
NSTemporaryExceptionAllowsInsecureHTTPLoads
NSTemporaryExceptionMinimumTLSVersion
TLSv1.1
```
For more information about ATS go to:
## Install with Carthage
To integrate WebViewController into your Xcode project using Carthage, specify it in your ```Cartfile```
```
github "allaboutapps/DataSource", ~> 4.1
```
This framework has to build with xcode8+
## Version Compatibility
Current Swift compatibility breakdown:
| Swift Version | Framework Version |
| ------------- | ----------------- |
| 5.2 | 4.1 |
| 5.0 | 3.1 |
| 4.0 | 3.0 |
| 3.0 | swift3 |
| 2.3 | 1.2 |
## Tests
Open the Xcode project and press `⌘-U` to run the tests.
Alternatively, all tests can be run from the terminal using [xctool](https://github.com/facebook/xctool).
```bash
xctool -scheme OAuthTests -sdk iphonesimulator test
```
## Contact
Feel free to get in touch.
*