This file contains hidden or 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
| import Foundation | |
| /** | |
| Extension to save/load a JSON object by filename. (".json" extension is assumed and automatically added.) | |
| */ | |
| extension JSONSerialization { | |
| static func loadJSON(withFilename filename: String) throws -> Any? { | |
| let fm = FileManager.default |
This file contains hidden or 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
| // Created by Norsez Orankijanan on 17/5/2561 BE. | |
| import UIKit | |
| //MARK: a separate view controller for showing the search results works better with a storyboard or xib. | |
| class ResultsTableViewController: UITableViewController { | |
| var items = [String] () | |
| let CELLID = "CELLID" | |
| override func viewDidLoad() { | |
| super.viewDidLoad() |
This file contains hidden or 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
| extension String { | |
| var isPalindrome: Bool { | |
| let reversed = String( self.reversed() ) | |
| for index in self.indices { | |
| if self.lowercased()[index] != reversed.lowercased()[index] { | |
| return false | |
| } | |
| } |
OlderNewer