Daniel Gomez Rico
Daniel Gomez Rico

Reputation: 15936

typealias in class vs in function in swift (iOS)

  1. What's the difference between a typealias declaration in class vs its declaration inside a function?

  2. Is there any performance detail?

  3. Is it a good idea to use them inside functions?

Upvotes: 4

Views: 710

Answers (1)

qwerty_so
qwerty_so

Reputation: 36295

  1. The difference is just the scope. A declaration inside a function hides one from outside.

  2. Since this is handled all by the compiler it has nothing to do with performance.

  3. Use it, where it makes sense (from a scope view)

Upvotes: 8

Related Questions