passforios/pass/Controllers/OpenSourceComponentsTableViewController.swift

51 lines
2 KiB
Swift
Raw Normal View History

2017-02-09 01:41:17 +08:00
//
// OpenSourceComponentsTableViewController.swift
// pass
//
// Created by Mingshen Sun on 9/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import UIKit
class OpenSourceComponentsTableViewController: BasicStaticTableViewController {
let openSourceComponents = [
2017-02-09 13:16:42 +08:00
["FavIcon",
"https://github.com/bitserf/FavIcon",
"https://github.com/bitserf/FavIcon/blob/master/LICENSE"],
2017-02-09 01:41:17 +08:00
["PasscodeLock",
"https://github.com/zahlz/SwiftPasscodeLock",
"https://github.com/zahlz/SwiftPasscodeLock/blob/master/LICENSE.txt"],
["ObjectiveGit",
"https://github.com/libgit2/objective-git",
"https://github.com/libgit2/objective-git/blob/master/LICENSE"],
["ObjectivePGP",
"https://github.com/krzyzanowskim/ObjectivePGP",
"https://github.com/krzyzanowskim/ObjectivePGP/blob/master/LICENSE.txt"],
2017-02-09 01:41:17 +08:00
["SwiftyUserDefaults",
"https://github.com/radex/SwiftyUserDefaults",
"https://github.com/radex/SwiftyUserDefaults/blob/master/LICENSE"],
["SVProgressHUD",
"https://github.com/SVProgressHUD/SVProgressHUD",
"https://github.com/SVProgressHUD/SVProgressHUD/blob/master/LICENSE.txt"],
]
override func viewDidLoad() {
tableData.append([])
for item in openSourceComponents {
tableData[0].append(
2017-02-09 11:12:14 +08:00
[CellDataKey.type: CellDataType.link, CellDataKey.title: item[0], CellDataKey.link: item[1], CellDataKey.accessoryType: UITableViewCellAccessoryType.detailDisclosureButton, CellDataKey.detailDisclosureAction: #selector(actOnDetailDisclosureButton(_:)), CellDataKey.detailDisclosureData: item[2]]
2017-02-09 01:41:17 +08:00
)
}
navigationItemTitle = "Open Source Components"
super.viewDidLoad()
}
2017-02-09 11:12:14 +08:00
func actOnDetailDisclosureButton(_ sender: Any?) {
if let link = sender as? String {
UIApplication.shared.open(URL(string: link)!, options: [:], completionHandler: nil)
}
}
2017-02-09 01:41:17 +08:00
}