Skip to content

OxayMint/24Stream-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

24stream

CI Status Version License Platform

An iOS plugin for generating 24Stream HTML widgets to be used in WKWebView or any other nested browser.

Installation

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

pod '24stream'

Usage

You need to import it as import _24stream. After that you can use Stream24 namespace which contains:

GetHtml

Parameter Type Description
brand string Required. Brand name for the page
productId string Required. Prouct ID for the page
retailerDomain string Required. Domain of the retailer of the page
templateType string Required. Template type of the page
language string Language of the page. Defaults to ru
resultType Stream24ResultType Result type of the page. One of .json, .html or .iframe. Defaults to .html
contentType Stream24ContentType Content type of the page. One of .shopInShops or .minisite. Defaults to .minisite

Returns the HTML code of the page which can be used to render inside a webview like WKWebView.

Example

import SwiftUI
import WebKit
import _24stream

struct ContentView: UIViewRepresentable {

    var html = Stream24.GetHTML(brand: "Samsung", retailerDomain: "irshad.az", productId: "16651081549")
    
    func makeUIView(context: Context) -> WKWebView {
        let config = WKWebViewConfiguration()
        let webView = WKWebView(frame: .zero, configuration: config)
        webView.allowsBackForwardNavigationGestures = true
        return webView
    }
 
    func updateUIView(_ uiView: WKWebView, context: Context) {
        uiView.loadHTMLString(html, baseURL: nil)
    }
    
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

License

24stream is available under the MIT license. See the LICENSE file for more info.

About

24Stream plugin for iOS/Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published