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

Anthia Tillbury
Anthia Tillbury
3,388 Points

Why can't Swift import multiple frameworks on the same line?

Unlike with Enumeration, where separate members can be on the same line, negating the need to prefix each with "case", why can't I import Frameworks in the same manner:

e.g.

import UIKit, Framework...

2 Answers

JLN CRML
JLN CRML
30,362 Points

Technically it would be possible, Apple just didn't include it in the compiler. If you want it all in one line the only thing you can do is put Semicolons between the import statements. For other developers, it is probably easier to see all the import statements underneath each other. By the way, other all other languages I know are doing it the same way, most of the times you have to specify the sub package directly, which would make it extremely hard to read if it was all in one line.

Anthia Tillbury
Anthia Tillbury
3,388 Points

I thought so. I don't know why because it would be more in tune with how the language seems to flow, but I'm just a beginner.

Thanks for the info.

JLN CRML
JLN CRML
30,362 Points

You can always leave suggestions at Bugreport if you like. You are welcome!