mitchellallison / WarningLights

An Xcode plug-in that flashes your Philips Hue light bulbs different colours depending on the result of your build.
MIT License
93 stars 10 forks source link

Replaced method swizzling with IDEBuildOperationDidStopNotification observer #2

Closed mttrb closed 10 years ago

mttrb commented 10 years ago

I am in the process of adapting Warning Lights to use a different light and have done some optimisation.

The IDEBuildOperationDidStopNotification works in the testing I have done and is a lot less intrusive than the existing method swizzling.

I don't have a Phillips Hue so I haven't been able to check that this actually works with the lights but I haven't changed anything to do with the lights so I don't see why there would be a problem.

mitchellallison commented 10 years ago

Great point.

I believe I initially used the above notification, but during developer previews of Xcode the number of warnings and errors returned from the IDEActivityLogSection object were not consistent with the displayed warnings and errors. I think I played around with a number of different methods and found that the internal method that was swizzled returned a more accurate representation. Since then, the issues appear to have been fixed.

Thanks also for the compiler directives to remove the warnings.

mttrb commented 10 years ago

Ah OK, that makes sense. I thought there was probably a reason why you went with the swizzling and wasn't sure if I'd missed something.

Also, I was a bit concerned that you were swizzling each time a project was opened as this feels like you'd swizzle back the original method when you opened an even number of projects. I never actually checked to see if this is the case so again I might have missed something. Something to consider if you ever need to switch back to the swizzle.

mitchellallison commented 10 years ago

Looking back I imagine that would have been the case. Thanks for the feedback!