-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adds class methods and strongly typed return values. #8
base: master
Are you sure you want to change the base?
Conversation
This is amazing. But let's not introduce a mode. Please just change the behavior. |
…th a more robust class generator.
I removed the mode and added some class generator methods (instead of printing strings). Let me know what you think. |
@@ -7,6 +7,11 @@ | |||
// See the LICENSE file distributed with this work for the terms under | |||
// which Square, Inc. licenses this file to you. | |||
|
|||
@interface CGTAFlagCollectionViewCell : UICollectionViewCell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you moved this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order for CGTAMasterViewController's dequeueImageCellForIndexPath:ofCollectionView: method to return an instance of CGTAFlagCollectionViewCell rather than UICollectionViewCell, it must be able to import the header file which defines that class. By moving the definition to the .h file, it will return this stronger type.
…ion view asked for a cell. Now it only computes allImages one time. The identifiers now also output constraint original constant values, which is comes in handy when using auto layout. Updated the sample app to show where this may be useful. As a side effect, the sample app can now be used to quiz yourself on the country flags: tap a flag, think of the country name, then tap to see if you were correct.
I implemented your recommendations, and added a new storyboard feature which caches the constraint constant values. If you think this should be a separate feature, let me know and I'll put it into another branch. |
… files. In order to determine if a class can be imported, it now looks for a file of the same name as the class (e.g. MyCustomClass.h). While this isn’t perfect, it does seem to handle most of the cases at a significant performance boost. In order to show how dequeueImageCellForIndexPath:ofCollectionView: can return a CGTAFlagCollectionViewCell instance, the demo app has been updated to separate CGTAFlagCollectionViewCell into its own file.
if (sender.state == UIGestureRecognizerStateEnded) { | ||
// the label was positioned perfectly via the storyboard, so now we can restore | ||
// the perfect positioning easily, by refering to the constant that was generated for us! | ||
self.countryNameTopConstraint.constant = self.countryNameTopConstraint.constant == 0 ? [self countryNameTopConstraintOriginalConstant] : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy equality comparisons between floating-point numbers and integer literals, Batman!
(Seriously, while this does work in this case, it's probably a bad idea to do this kind of thing in example code that will be copied ad nauseam.)
In regards to the first comment about floating point comparisons, what kind of fix are you looking for?
|
Probably the third one. |
…meHackeryMethod’ name. Added a boolean property to prevent the need for float comparison.
This all looks good. You should update the docs before this is merged. |
…plicate identifiers by removing them.
I improved the support for UICollectionViews, and it now handles duplicate identifiers much better. The read me was also updated as you suggested. |
… names. This gives the user more control over the generated method names. Added constants for scene identifiers. Added a way to generate documentation for generated methods.
…lor colorWithRed:green:blue:alpha:] uses.
…dded view controllers and segues with illegal identifiers to show that it handles them correctly (i.e. it no longer causes build errors). Created a test color scene which shows that Michael Thole’s color fix is correct.
…y of making a class extension was in place.
@puls @oy65 This looks like exactly what my project needs. But is this project still going to be maintained? Any recommendations for similar tools? |
See the updated example project for how category methods and strong types work.
Here's a quick example:
becomes
CGTADetailViewController *detailViewController = [CGTAMainStoryboard instantiateDetailViewController];
Segues, collection view cells, and table view cells are scoped to the view controller.