Last active
February 18, 2017 06:04
-
-
Save suprie/49cf37ff346b158435c5f9f7dd3ef29c to your computer and use it in GitHub Desktop.
Bad Smelled VC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converted with Swiftify v1.0.6242 - https://objectivec2swift.com/ | |
class ViewController { | |
override func viewDidAppear(_ animated: Bool) { | |
var paths: [Any] = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) | |
var docsPath: String = paths[0] | |
var path: String = URL(fileURLWithPath: docsPath).appendingPathComponent("abc.sqlite").absoluteString | |
database = FMDatabase(path: path) | |
database.open() | |
var resultSet: FMResultSet? = database.executeQuery("SELECT * FROM products") | |
var listOfProducts = [Any]() | |
while resultSet?.next() { | |
var dictionary: [AnyHashable: Any]? = [ | |
"code" : resultSet?.string(forColumn: "code"), | |
"name" : resultSet?.string(forColumn: "name"), | |
"id" : Int(resultSet?.int(forColumn: "id")) | |
] | |
listOfStation.append(dictionary) | |
} | |
var sortByFav = NSSortDescriptor(key: "favorite", ascending: false) | |
var sortByName = NSSortDescriptor(key: "name", ascending: true) | |
arrayOfStations = (listOfProducts as NSArray).sortedArray(using: [sortByFav, sortByName]) | |
self.view.backgroundColor = UIColor(patternImage: UIImage(named: "splash_bg")) | |
self.aTableView.backgroundColor = UIColor.clear | |
self.aTableView.reloadData() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment