how compiler know the datatype of variable in swift if its not determined code example
Example: declaring optionals swift
var myOptional: Any? // any can be replaced with whatever type you need
var myOptional: Any? // any can be replaced with whatever type you need