WWJavaScriptContext+CSV

main

Use JavaScript to convert CSV text.
William-Weng/WWJavaScriptContext_CSV

WWJavaScriptContext+CSV

Swift-5.6 iOS-14.0 Swift Package Manager-SUCCESS LICENSE

dependencies: [
    .package(url: "https://github.com/William-Weng/WWJavaScriptContext_CSV.git", .upToNextMajor(from: "1.0.0"))
]

Function - 可用函式

函式 功能
convertArray(source:) 轉換Markdown => Array
convertJSValue(source:) 轉換Markdown => JSValue

Example

import UIKit
import WebKit
import WWPrint
import WWJavaScriptContext
import WWJavaScriptContext_CSV

final class ViewController: UIViewController {
    
    @IBOutlet weak var myTextView: UITextView!
    @IBOutlet weak var myWebView: WKWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func convertCSV(_ sender: UIButton) {
        
        defer { view.endEditing(true) }
        
        guard let text = myTextView.text,
              let array = WWJavaScriptContext.CSV.shared.convertArray(source: text),
              let jsonString = array._jsonString()
        else {
            return
        }
        
        myWebView.loadHTMLString("\(jsonString)", baseURL: nil)
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 16:38:15 GMT-0900 (Hawaii-Aleutian Daylight Time)