Define a typealias for the whole project
Asked Answered
C

2

13

In which file can I define a typealias that works in the whole project, etc.

typealias S = String
Cassy answered 28/1, 2016 at 15:43 Comment(0)
H
28

the typealias works the same way as variables. If you want to be global put it outside the class scope at any file.

Haihaida answered 28/1, 2016 at 15:49 Comment(1)
ahh thanks!! :) thought it had something to do with the ProjectName-Swift.h fileCassy
S
0

typealias is use to aliasing the existing Data Types. Its access scope is same as a variable, if its declared in side the block like class, struct, protocol etc then its visibility also remains inside that block only. it can not be used outside to declare a new variables of that type.

Selfinterest answered 5/12, 2022 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.