Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializers that return nil #53

Closed
radex opened this issue Aug 23, 2014 · 3 comments
Closed

Initializers that return nil #53

radex opened this issue Aug 23, 2014 · 3 comments

Comments

@radex
Copy link
Collaborator

radex commented Aug 23, 2014

https://devforums.apple.com/message/1028133#1028133

anyone wants to write up? ;)

@ksm
Copy link
Owner

ksm commented Aug 29, 2014

Added in db730ce.

@radex Please check if what I wrote makes sense.

@ksm ksm closed this as completed Aug 29, 2014
@radex
Copy link
Collaborator Author

radex commented Aug 29, 2014

It does, but I'd clarify a bit. The point is that Swift initializers cannot return an optional type — yet imported initialisers from Objective-C classes might return nil.

I'd also mention the workaround — you can cheat the type checking system if you assign the returned (supposedly non-optional value) to an optional variable.

@ksm ksm reopened this Aug 29, 2014
@ksm
Copy link
Owner

ksm commented Aug 31, 2014

Perfect. Added that in.

@ksm ksm closed this as completed Aug 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants