0

I am creating an App in which I have to declare some constant as global. in Obj C I could use pch file but I don't know how to define in Swift? For Example

in Obj C .pch file if I declare

define Red [UIColor redColor]

then it works through out application.

Community
  • 1
  • 1
M Swapnil
  • 2,361
  • 3
  • 18
  • 33

1 Answers1

0

All you need to do is create a Constants.swift (or what ever you want to name it) file and then add what ever constants you need into it.

let myVariable = "Some Value"
let myOtherVariable = "Something Else"

They will then be available throughout your application.

sbarow
  • 2,759
  • 1
  • 22
  • 37