Latest 0.0.3
Homepage https://github.com/shien7654321/STPostWebView
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit, WebKit
Authors

Version
License
Platform

A subclass of WKWebView that supports requested by POST

STPostWebView is a subclass of WKWebView that supports requested by POST.

STPostWebViewPreview01

Requirements

  • iOS 8.0 or later
  • ARC
  • Swift 4.2

Installation

STPostWebView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'STPostWebView'

Usage

Import headers in your source files

In the source files where you need to use the library, import the header file:

import STPostWebView

Initialize STPostWebView

STPostWebView is a subclass of WKWebView. You can initialize it like WKWebView:

STPostWebView(frame: frame, configuration: configuration)

Load POST request

var urlString = "http://xxxx:xxxx/xxxx"
let getParameterString = "key1=value1&key2=value2"
urlString += "?" + getParameterString
var request = URLRequest(url: URL(string: urlString)!)
request.httpMethod = "POST"
let postParameterString = "key3=value3&key4=value4"
request.httpBody = postParameterString.data(using: .utf8)
webView.load(request)

Run Example

In the Example directory there is a pages folder with some web files. Because PHP is used to write these web files, you need to configure the PHP environment on your computer. Then use the pages folder to start a server.

Finally, set the host of this server in the Example project, for example:

// ViewController.swift

let host = "http://localhost:80"

Author

Suta, [email protected]

License

MIT license.

Latest podspec

{
    "name": "STPostWebView",
    "version": "0.0.3",
    "summary": "A subclass of WKWebView that supports requested by POST.",
    "homepage": "https://github.com/shien7654321/STPostWebView",
    "authors": {
        "Suta": "[email protected]"
    },
    "source": {
        "git": "https://github.com/shien7654321/STPostWebView.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "frameworks": [
        "Foundation",
        "UIKit",
        "WebKit"
    ],
    "source_files": "STPostWebView/*.{swift}",
    "compiler_flags": "-fmodules",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.2"
    },
    "description": "STPostWebView is a subclass of WKWebView that supports requested by POST."
}

Pin It on Pinterest

Share This