CODEX

Photo by Ilija Boshkov on Unsplash

1. Shorter If…Else Statements with Ternary Operators

let money = 100if money > 0 {
print("Some money")
} else {
print("No money")
}
money > 0 ? print("Some money") : print("No money")

2. Destructuring Tuples

func getInfo() -> (name: String, email: String) {
return (name: "Matt", email: "matt@example.com")
}


Learn how to add a continuously flowing smooth animated gradient to your app.

Setting Up the Gradient

Choosing the colors

Using the Colors

let color1: CGColor = UIColor(red: 209/255, green: 107/255, blue: 165/255, alpha: 1).cgColorlet color2: CGColor = UIColor(red: 134/255, green: 168/255, blue: 231/255, alpha: 1).cgColor


CODEX

Learn what are structures and classes, what are the key differences and how to choose between them.

Photo by Markus Winkler on Unsplash

A Brief Comparison

The Key Difference


Make your life easier when dealing with arrays in JavaScript.

Photo by Tianyi Ma on Unsplash

1. Array.find()

{
brand:"Skoda",
price:15000
}

2. Array.concat()


Use Swift’s built-in array methods to make your life easier and code prettier

Code on laptop
Code on laptop
Photo by Blake Connally on Unsplash.

1. Array.filter()


Write less to achieve more.

Photo by Martin Shreder on Unsplash

1. One-Liner If-Else

2. One-Liner Functions

3. Swap Two Variables without a Helper Variable


Learn one of the basics of iOS app development with easy and beginner-friendly examples

Learn Swift: Working with JSON
Learn Swift: Working with JSON
Image credit: Author


What is a recursive enumeration and what does the “indirect” keyword do?

Code on laptop
Code on laptop
Photo by James Harrison on Unsplash.
enum Test {
indirect case value(Test)
}
indirect enum Test {
case value(Test)
}

Example


Learn these amazing shorthands and one-liners for writing clean and fast code

Text on yellow background
Text on yellow background
Photo by the author.

1. One-Liner if-else Statements

2. Nullish Coalescing


Learn some funny Python oddities

WTF?! Python (head exploding and lol emojis)
WTF?! Python (head exploding and lol emojis)

1. Sometimes Two Equal Numbers Aren’t Equal

>>> a = 256
>>> b = 256
>>> a is b
True
>>> a = 257
>>> b = 257
>>> a is b
False

How does it work

Artturi Jalli

Tech Expert, Entrepreneur, Software Engineer from Finland. Writing about programming and science. Check out my blog at https://www.codingem.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store