iOS Dev Nugget 291 Implicit Member Expressions


Need to run a code review on your codebase? Hire me

You have probably used Implicit Member Expressions without knowing what it's called:

var color: UIColor?
color = .white

i.e. the member of a type can be accessed from an inferred type.

You can access static functions:

foo(i: .createInstance())

Did you know that it works with .init() too?

class C {
    static func foo() -> C {
        return .init()
func bar(c: C) {}

bar(c: .init())

Notice the 2 calls to init() above.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No



Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues