2019-04-10-12-Swift5

Testing interger multiples

Output:
It's multiple of 5

Escaping Raw strings

var rawText = #"""
Hey! I can write anything "here"
without using double double quotes \#(someNumber)
"""#
Output:
Hey! I can write anything "here"
without using double double quotes 10

isNumber to check a char value

var text = "SK10"
for char in text {
    print("Is '\(char)' number? \(char.isNumber)")
}

Similarly, isASCII, isLetter, isSymbol, isSymbol etc. are available. Go ahead & give a try.

Use 'KeyValuePairs' instead 'DictionaryLiteral'

compactMapValues

In following example, with compactMapValues, I was able to convert [String: String] to [String: Int]

Future Enum cases

Last updated

Was this helpful?