Re:What we learned from rewriting our robotic control softwa...
by Charybdis on Tuesday November 03, 2015 @07:19PM
(#10503729)
Chances are, the window you want is the window the view is in (which is probably the same as your app's window), UIView has a handy property for that.
[self.view convertPoint:apoint toView:self.view.window];
Re:What we learned from rewriting our robotic control softwa...
by aaronbrethorst on Tuesday November 03, 2015 @04:45PM
(#10502941)
[self.view convertPoint:apoint toView:[UIApplication sharedApplication].keyWindow];
No reason to skip the other places where dot notation would be useful.
Re:What we learned from rewriting our robotic control softwa...
by morbidhawk on Tuesday November 03, 2015 @04:50PM
(#10502967)
Ok my example was a bad example because keyWindow is a property. But I find myself breaking up lines of code over and over again just for the reason that it can't figure out how to autocomplete due to the bracket hell. And I leave it broken apart because if I don't now a later refactoring likely will anyway.
This makes a lot of sense. In Objective-C chaining too many method calls together gets ugly and you end up having to break it up into multiple lines of code for your own sanity. Take the code below, autocompletion is guaranteed to break on you for the Objective-C version.
Objective-C:
Swift: Objc Refatored: