I have array from json:
var list = ["one"],["two"],["three"]
how to join them to become `["one","two","three"]
I'm using dropdown from this https://github.com/jriosdev/iOSDropDown
it needs to be :
// The list of array to display. Can be changed dynamically.
trfBankTujuan.optionArray = ["nama 1", "nama 2", "nama 3", "nama 4"]
i want to fill those list of array from JSON:
"data_transaction": [
{
"kode": "002",
"nama": "nama 1"
},
{
"kode": "011",
"nama": "nama 2"
},
{
"kode": "008",
"nama": "nama 3"
},
{
"kode": "009",
"nama": "nama 4"
}
]
var banknya: String = ""
class APITrf: NSObject {
class func BankList(completion: @escaping (_ error: Error?, _ banklikst: [Bank]?)->Void) {
Alamofire.request(url, method: .get, parameters: nil, encoding: URLEncoding.default, headers: headers)
.responseJSON { response in
switch response.result
{
case .failure(let error):
print(error)
case .success(let value):
let json = JSON(value)
print(json)
if let status = json["status"].string {
if (json["status"] == "00") {
print("status: \(status)" + " = sukses")
let dataBank = json["data_transaction"].array
}
} else {
if (json["status"] != "00") {
print("must return to login screen")
}
}
for (index,subJson):(String, JSON) in json["data_transaction"] {
if let nama_Bank = subJson["nama_bank"].string {
banknya = nama_Bank
print(banknya)
}
}
Then i want to put those object "banknya" into :
import UIKit
import iOSDropDown
class AB: UIViewController {
func dropDownBankList() {
trfBankTujuan.optionArray = [banknya]
}
}