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
class SettingViewControllerActionDecider : SettingViewControllerProtocol { | |
private let PasswordProtectedKey = "front" | |
var isPasswordProtected: Bool { | |
get { | |
guard let front = UserDefaults.standard.object(forKey: PasswordProtectedKey) as? Bool else { return false } | |
return front | |
} |
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
import UIKit | |
protocol SettingViewControllerProtocol { | |
var isPasswordProtected: Bool { get set } | |
func validate(password: String?, confirmPassword: String?, from: SettingViewController) -> Bool | |
} | |
class SettingViewController: UIViewController { |
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
class SettingViewController: UIViewController { | |
@IBOutlet weak var PasswordTextField: UITextField! | |
@IBOutlet weak var RepasswordTextField: UITextField! | |
@IBAction func Save(_ sender: UIButton) { | |
if PasswordTextField.text == RepasswordTextField.text { | |
self.userDefaults.set(PasswordTextField.text, forKey: "front") | |
self.userDefaults.synchronize() |
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
private struct FetchSuccess { | |
let asignees: [IssueAssigneeViewModel] | |
let nextPage: Int? | |
} | |
private func fetch(owner: String, | |
repo: String, | |
pageNumber: Int, | |
completion: @escaping (Result<FetchSuccess>) -> Void) { |
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
override func fetch(page: String?) { | |
// Protect your inputs. | |
let requestedPage: Int | |
if let givenPageString = page, | |
let givenPageInt = Int(givenPageString) { | |
requestedPage = givenPageInt | |
} else { | |
requestedPage = 1 | |
} |
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
override func fetch(page: String?) { | |
client.client.send( | |
V3AssigneesRequest( | |
owner: owner, | |
repo: repo, | |
page: (page as NSString?)?.integerValue ?? 1 | |
) | |
) { [weak self] result in | |
switch result { |
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
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", | |
for: indexPath as IndexPath) as! ContactCellTableViewCell | |
let contactsInSection = yourContacts[indexPath.section] as! NSArray | |
let contactForRow = contactsInSection[indexPath.row] as! APContact | |
cell.nameLabel.text = contactForRow.name?.compositeName ?? "" | |
cell.phoneLabel.text = contactForRow.phones?.first?.number |
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
override func numberOfSections(in tableView: UITableView) -> Int { | |
guard yourContacts.count > 0 else { return 0 } | |
return UILocalizedIndexedCollation.current().sectionTitles.count | |
} | |
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
let contactsInSection = yourContacts.object(at: section) as! NSArray | |
return contactsInSection.count |
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
override func numberOfSectionsInTableView(tableView: UITableView) -> Int { | |
// #warning Potentially incomplete method implementation. | |
// Return the number of sections. | |
var numberOfSections = UILocalizedIndexedCollation.currentCollation().sectionTitles.count | |
//println("numberOfSections: \(numberOfSections)") | |
return numberOfSections | |
} | |
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
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
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
let cell:ContactCellTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as ContactCellTableViewCell | |
if(yourContacts.count > 0){ | |
let contact = yourContacts[indexPath.section][indexPath.row] as APContact | |
cell.nameLabel.text = contact.compositeName != nil ? contact.compositeName : "" | |
cell.phoneLabel.text = contact.phones.count > 0 ? contact.phones[0] as String : "" | |
cell.emailLabel.text = contact.emails.count > 0 ? contact.emails[0] as String : "" | |