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
//Teams play for Cricket world cup 2015 super 8 | |
var superEight = ["NZ","Aus","SL","Bang","Ind","SA","Pak","WI"] | |
for (index, value) in enumerate(superEight){ | |
println("Team \(index+1) : \(value)") | |
} |
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
//My favourite movies | |
var favouriteMovies = ["Inception","Theory of Everything","Fifty Shades of Grey"] | |
//I have new favourite | |
favouriteMovies += "PK" | |
//Ohh forgot The Hunger Games | |
favouriteMovies += ["Hunger Games","Catching Fire","Mocking Jay"] | |
//Hmm. Replace Fifty Shades and PK with new favourites I happened to watch recently -> Interstellar and The Social Network |
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
let netWorthOfBillionaires = ["Bill Gates":78.5,"Carlos Slim Helu":71,"Warren Buffett":70.9] | |
let possibleNetWorth = netWorthOfBillionaires["Tim Cook"] | |
//Type of the possibleNetWorth is inferred to Double? | |
//Know what! Tim cook is not a billionair yet. His net worth is aroung $400 million | |
//Thats why he is not in our list. But who knows. He might becomes a billionair | |
if (possibleNetWorth != nil){ |
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
//Swift Function | |
func keepCalmAndLearnSwift(){ | |
println("Ohh yeah. Learning Swift") | |
} | |
//Swift function with parameters | |
func keepCalmAndLearn(language: String){ | |
println("Ohh yeah. Learing \(language)") |
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
[ | |
{ | |
"symbol": "$", | |
"name": "US Dollar", | |
"symbol_native": "$", | |
"decimal_digits": 2, | |
"rounding": 0, | |
"code": "USD", | |
"name_plural": "US dollars" | |
}, |
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
MODEL_PATH="$PROJECT_DIR/<RootDirectory>/<ModelName>.xcdatamodeld" | |
OUTPUT_DIRECTORY="$PROJECT_DIR/<RootDirectory>/Classes/Model" | |
mogenerator --v2 --model $MODEL_PATH --output-dir $OUTPUT_DIRECTORY |
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
//Define a class Cat | |
class Cat { | |
} | |
enum EnumWithRaw : Cat{ | |
/* | |
INVALID | |
[Error]: Raw Type Cat is not convertible from any literal | |
[Reason]: Raw value of enum have to be of type strings, characters, or any of the integer or floating-point number types. |
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
IFS=$'\n' | |
function tagAllIcons(){ | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
APP_ICONS_PATH="${PROJECT_DIR}/BuildNumberTagger/Images.xcassets/AppIcon.appiconset" | |
REFERENCE_ICONS_PATH="${PROJECT_DIR}/BuildNumberTagger/AppIconReference.xcassets" | |
for ICON_PATH in $(find ${REFERENCE_ICONS_PATH} -name "*Icon*.png") |
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 UIView{ | |
func boundInside(superView: UIView){ | |
self.translatesAutoresizingMaskIntoConstraints = false | |
superView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[subview]-0-|", options: NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics:nil, views:["subview":self])) | |
superView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-0-[subview]-0-|", options: NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics:nil, views:["subview":self])) | |
} |
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
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t] | |
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?: | |
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:( | |
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ | |
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0 | |
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\ | |
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+ | |
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?: | |
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z | |
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n) |
OlderNewer