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
// A snippet for extending a UITableViewController class, | |
// allowing the selection of only one row through the Checkmark accssory. | |
// If you using a stand alone UITableView, then implement these methods in your delegate object. | |
// For checking which row is selected, check the indexPathForSelectedRow property of the tableView. | |
// This code is implemented in the latest version of Swift, which is Swift 3, as of today... | |
extension <#Your UITableViewController class#> { | |
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
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
extension Array where Element: SignedInteger { | |
static func findMaxInt(arr:[Int]) -> Int{ | |
var previous = Int() | |
var max = Int() | |
arr.forEach { (n) in | |
max = n > previous && n > max ? n : max | |
previous = n; |
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
// Created on 6/2/15 by Christopher Gonzalez D.K.A. @gchriswill https://github.com/JWShroyer | |
// Reviewed and optimyzed by Josh Shroyer D.K.A @JWShroyer https://github.com/JWShroyer | |
// Last revision on 7/11/15 by @gchriswill and @JWShroyer | |
extension Array { | |
mutating func countForward(inout counter c: Int) -> Void { | |
var s = self.count - 1 | |
c = c < s && !(0 > c) ? (c + 1) : 0 |
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
//Save the value of the field into a variable | |
var emailValue = emailField.getValue(); | |
/* This formula or method condition in five easy steps | |
* | |
* 1- First searches for an "@" in the string | |
* 2- Then it checks for more than one "@" | |
* 3- Then checks if the subdomain area is less than 4 characters | |
* 4- Then checks if the position of the last "." is less than 3 spaces after the "@" | |
* 5- Then checks if there are two or less characters after the last "." |