1

With Objective C, I used 'FileName.h' header file to declare all constants values with #default and it can be accessed from any other classes by importing the constants.h file.

In Swift: What is the alternate to that in swift?

SARANGA
  • 172
  • 1
  • 8

2 Answers2

0

Make a Constants.swift file. Following file will help you. eg.:

class Constants: NSObject 
{
    static let msg = ""
    static let text = ""
}
Bhagyalaxmi Poojary
  • 1,213
  • 1
  • 12
  • 17
0

Just create a class somewhere which only has static variables.

class Constant {
    static let a = "demo1"
    static let b = "demo2"
}
Flovdis
  • 2,945
  • 26
  • 49