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

Maximum size of an identifier

What is the maximum size of an identifier allowed in Swift?

I created a 101 character identifier and Xcode accepted it. I would assume that an array is used by the Swift compiler to handle identifiers. If true it would depend on the size of the array item used by the complier. That is something only the Apple Swift developers know and they may believe it is proprietary.

4 Answers

I want to mark your answer as best answer but getting any option to do so. Any idea on it. :)

Thanks hans. I had tried creating a long identifier name, more than 100 characters and it worked fine. I was wondering if there is a real limit on the identifier name.

As I mentioned, it is something that the developers of Swift know and I suspect that they are not telling. Though it seems that a very long identifier might be hard to read and understand. Probably not good code. Good luck with iOS and Swift.

Thanks again hans. I tried with 2k characters and that also worked. :)

Thank you. I appreciate your consideration, but it is not necessary to mark my answer as best. The fact you consider it is all I need. Keep up the good work.