Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS iOS Design Patterns Two-Stage Object Creation Alloc Init

Marcos Reboucas
Marcos Reboucas
12,890 Points

Does Swift also uses 'two stage object creation' design pattern?

Since in Swift we don't explicit use alloc init, i'm wondering if 'two stage object creation' design pattern is also applicable for it. I mean are Swift objects allocated the same way Objective-C 'under the hood'?

1 Answer

Bjorn Chambless
STAFF
Bjorn Chambless
Treehouse Guest Teacher

Under the hood it all works the same, so all the same coding techniques apply (designated initializers, convenience initializers, etc..), but the syntax hides the details.

One change of note: "class methods" are now "type methods"