DEV Community

Opeyemi Noah
Opeyemi Noah

Posted on

1 1

Day 4/100 day of SwiftUI

Mission log 4.

Type Annotation

Type annotation let us state what data type we want for our variable and constant.

example:

var name: String = "Opeyemi"
Enter fullscreen mode Exit fullscreen mode

Type inference is when swift is able to figure out the data type of a variable or constants, based on value we assign.

example:

var name = "John Doe"
Enter fullscreen mode Exit fullscreen mode

From the snippet above , swift will infer the data type to be String, because we assign text value to the variable.

Top comments (0)

Sentry mobile image

Improving mobile performance, from slow screens to app start time

Based on our experience working with thousands of mobile developer teams, we developed a mobile monitoring maturity curve.

Read more