Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ARC Migration #81

Merged
merged 28 commits into from

7 participants

@jspahrsummers

High-level changes:

  • Migrated framework project and sample project to ARC.
  • Moved build settings identical across targets up to the project level.
  • Enabled static analysis with every build.
  • Enabled link-time optimization in release builds.

Specific source-level changes (besides trivial ARC migration fixes):

  • Removed overridden release/retain logic from TUIFastIndexPath – necessary for ARC.
  • Renamed TUICGImageFromBitmapContext() to TUICreateCGImageFromBitmapContext(), changing its memory management semantics in the process – necessary for ARC.
  • Refactored -[TUIImage innerShadowWithOffset:radius:color:backgroundColor:] and -[TUIImage embossMaskWithOffset:] to not assign to self – necessary for ARC.
  • Refactored how TUIView handles subviews, keeping them in an explicit array instead of relying on finding them as layer delegates. Not strictly necessary for ARC, but this made the code a lot cleaner (and hopefully clearer) than otherwise.
  • In TUIGraphicsBeginImageContextWithOptions() and TUIGraphicsEndImageContext(), expect NSGraphicsContext to retain the context, balancing our retain count for the static analyzer. If this is a faulty assumption, this change can be reverted.
  • Removed deprecated TUIFont methods.

This was not exhaustively tested by any means (I don't have an existing project using TwUI), but both included projects build without issue, and the sample project runs without issue on 10.7.

jspahrsummers added some commits
@jspahrsummers jspahrsummers Migrate as many target settings up to the project level as possible 258f03c
@jspahrsummers jspahrsummers Analyze after every build 683f3b5
@jspahrsummers jspahrsummers Enable LTO for Release builds
Conflicts:

	TwUI.xcodeproj/project.pbxproj
dc4b4f8
@jspahrsummers jspahrsummers Remove obsolete build setting for Fix and Continue a26916c
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIColor 77ff369
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIFont 2979414
@jspahrsummers jspahrsummers Rename TUICGImageFromBitmapContext() to TUICreateCGImageFromBitmapCon…
…text() and change memory management semantics to be compatible with ARC, refactoring callers to match
bb29b6f
@jspahrsummers jspahrsummers Refactor -[TUIImage innerShadowWithOffset:radius:color:backgroundColo…
…r:] and -[TUIImage embossMaskWithOffset:] to not assign to 'self'
f37b085
@jspahrsummers jspahrsummers Fix ARC precheck warnings in CoreText additions a55ab10
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIAttributedString c5e3bf5
@jspahrsummers jspahrsummers Import TUIImage.h for use in TUIButton+Content.m cf92489
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIFastIndexPath (in part by removing me…
…mory management methods from the singleton implementation)
b0b2725
@jspahrsummers jspahrsummers Import TUINSWindow.h for use in TUIControl.m 06b6b7f
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIImage de8cd41
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUIKit functions aa9522b
@jspahrsummers jspahrsummers Import TUINSWindow.h for use in TUITableViewCell.m 35f09fc
@jspahrsummers jspahrsummers Import TUIView.h for use in TUITextRenderer+KeyBindings.m a793301
@jspahrsummers jspahrsummers Fix ARC precheck warnings in TUITextRenderer bfac7a2
@jspahrsummers jspahrsummers Refactor how TUIView handles subviews, for better memory management p…
…ractices and ARC compatibility
4df382d
@jspahrsummers jspahrsummers ARC migration, baby.
Conflicts:

	TwUI.xcodeproj/project.pbxproj
fac056b
@jspahrsummers jspahrsummers Use __unsafe_unretained instead of __weak, for compatibility with 10.6 614d42d
@jspahrsummers jspahrsummers Remove deprecated TUIFont methods 238a895
@jspahrsummers jspahrsummers Depend on NSGraphicsContext to retain/release image contexts -- don't…
… confuse the memory management by doing it ourselves
39a48b3
@jspahrsummers jspahrsummers Remove -[NSArray tui_map:], which is no longer used (and we have bloc…
…ks now, if we want to do it properly)
dba3430
@jspahrsummers jspahrsummers Make sample project refer to the framework target, instead of includi…
…ng the source wholesale
daa2aec
@jspahrsummers jspahrsummers Analyze sample project after every build
Conflicts:

	ExampleProject/Example.xcodeproj/project.pbxproj
068ec9c
@jspahrsummers jspahrsummers Migrate sample project to ARC
Conflicts:

	ExampleProject/Example.xcodeproj/project.pbxproj
9ff48dd
@jspahrsummers jspahrsummers Qualify some weak references called out in comments that I missed 59e2c91
@atebits

This is awesome, thanks (sorry I missed it until now). Not sure if everyone is ready to make the jump, but I'd love to merge this in soon.

@mrjjwright

I am ready. All my other code is ARC now and getting tired of excluding TwUIKit every time from ARC compilation.

@erndev

Same here. I create all new projects with ARC, and in github it also seems the trend. Since twui is quite recent, it's likely to be used in new projects, and not added to old ones, so i guess it's a natural step to move to ARC..
My only concern was backwards compatibility (10.6), but it seems it's been taken care of by using __unsafe_unretained instead of weak.

just my 2¢...

@joshaber
Collaborator

:+1:

@Machx

I'd like to add my vote for merging this in

@sandofsky sandofsky merged commit 03c9552 into twitter:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 13, 2011
  1. @jspahrsummers
  2. @jspahrsummers
  3. @jspahrsummers

    Enable LTO for Release builds

    jspahrsummers authored
    Conflicts:
    
    	TwUI.xcodeproj/project.pbxproj
  4. @jspahrsummers
  5. @jspahrsummers
  6. @jspahrsummers
  7. @jspahrsummers

    Rename TUICGImageFromBitmapContext() to TUICreateCGImageFromBitmapCon…

    jspahrsummers authored
    …text() and change memory management semantics to be compatible with ARC, refactoring callers to match
  8. @jspahrsummers

    Refactor -[TUIImage innerShadowWithOffset:radius:color:backgroundColo…

    jspahrsummers authored
    …r:] and -[TUIImage embossMaskWithOffset:] to not assign to 'self'
  9. @jspahrsummers
  10. @jspahrsummers
  11. @jspahrsummers
  12. @jspahrsummers

    Fix ARC precheck warnings in TUIFastIndexPath (in part by removing me…

    jspahrsummers authored
    …mory management methods from the singleton implementation)
  13. @jspahrsummers
  14. @jspahrsummers
  15. @jspahrsummers
  16. @jspahrsummers
  17. @jspahrsummers
  18. @jspahrsummers
  19. @jspahrsummers

    Refactor how TUIView handles subviews, for better memory management p…

    jspahrsummers authored
    …ractices and ARC compatibility
  20. @jspahrsummers

    ARC migration, baby.

    jspahrsummers authored
    Conflicts:
    
    	TwUI.xcodeproj/project.pbxproj
  21. @jspahrsummers
  22. @jspahrsummers
  23. @jspahrsummers

    Depend on NSGraphicsContext to retain/release image contexts -- don't…

    jspahrsummers authored
    … confuse the memory management by doing it ourselves
  24. @jspahrsummers

    Remove -[NSArray tui_map:], which is no longer used (and we have bloc…

    jspahrsummers authored
    …ks now, if we want to do it properly)
  25. @jspahrsummers
  26. @jspahrsummers

    Analyze sample project after every build

    jspahrsummers authored
    Conflicts:
    
    	ExampleProject/Example.xcodeproj/project.pbxproj
  27. @jspahrsummers

    Migrate sample project to ARC

    jspahrsummers authored
    Conflicts:
    
    	ExampleProject/Example.xcodeproj/project.pbxproj
  28. @jspahrsummers
Something went wrong with that request. Please try again.