Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adds class methods and strongly typed return values.#8

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
swiftal64 wants to merge13 commits intopuls:master
base:master
Choose a base branch
Loading
fromswiftal64:ubermode

Conversation

swiftal64
Copy link

See the updated example project for how category methods and strong types work.

Here's a quick example:

UIStoryboard *storyboard = [UIStoryboardstoryboardWithName:CGTAMainStoryboardNamebundle:nil];CGTADetailViewController *detailViewController = [storyboardinstantiateViewControllerWithIdentifier:CGTAMainStoryboardDetailViewControllerIdentifier];

becomes

CGTADetailViewController *detailViewController = [CGTAMainStoryboardinstantiateDetailViewController];

Segues, collection view cells, and table view cells are scoped to the view controller.

@puls
Copy link
Owner

puls commentedApr 2, 2014

This is amazing. But let's not introduce a mode. Please just change the behavior.

@swiftal64
Copy link
Author

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
Copy link
Owner

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?

Copy link
Author

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.

OY added2 commitsApril 3, 2014 14:13
…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.
@swiftal64
Copy link
Author

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;
Copy link
Owner

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.)

@pulspuls changed the titleAdded Uber Mode which adds class methods and strongly typed return values.Adds class methods and strongly typed return values.Apr 11, 2014
@swiftal64
Copy link
Author

In regards to the first comment about floating point comparisons, what kind of fix are you looking for?

  1. The more correct comparison with a float (i.e. just changing 0 to 0.0f)?
  2. Using an epsilon in the comparison?
  3. Using a boolean to keep track of the visibility, eliminating all floating point comparisons entirely?

@puls
Copy link
Owner

Probably the third one.

…meHackeryMethod’ name. Added a boolean property to prevent the need for float comparison.
@puls
Copy link
Owner

puls commentedMay 8, 2014

This all looks good. You should update the docs before this is merged.

@swiftal64
Copy link
Author

I improved the support for UICollectionViews, and it now handles duplicate identifiers much better. The read me was also updated as you suggested.

OYand others added4 commitsMay 13, 2014 14:26
… 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.
…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.
@jshier
Copy link

@puls @oy65 This looks like exactly what my project needs. But is this project still going to be maintained? Any recommendations for similar tools?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@swiftal64@puls@jshier@mthole

[8]ページ先頭

©2009-2025 Movatter.jp