Updating a Swiz 0.6.4 application to Swiz 1.0 will require the following changes:
Update configuration and creation of Swiz
Prior to 1.0, there was only one instance of Swiz. 1.0 now allows for multiple versions of Swiz, primarily to support modules and separate AIR windows. As a result, the creation of Swiz within the application will need to be modified.
In a 0.6.4 application, Swiz was created like this:
In Swiz 1.0, this would look like:
You might also note that several of the properties on Swiz have changed:
strictproperty has been renamed
validateEventTypes, and now defaults to
trueso in most cases it can be removed
mediateBubbledEventshas been removed since Swiz 1.0 mediates bubbled events automatically
beanLoadersproperty has been renamed to
beanProviders, and has been moved to the
viewPackagesnow accept package paths in both the format
myapp.events.*. Note that you still need to specify child packages separately even if you use the .* syntax.
injectionEventproperty has been renamed
setUpEventType, and now defaults to
Full details on configuration and the default values for 1.0 can be found in the Configuration section.
BeanLoader class has been deprecated in favor of
BeanLoader will still work in 1.0, but it is recommended that you update your code to
BeanProvider. In addition, a central dispatcher property was available within
BeanLoader in 0.6.4. This property has been removed in 1.0. If a bean or prototype bean requires a dispatcher from Swiz, this is now accomplished using the
[Dispatcher] metadata tag:
Removal of static methods
Since an application can now contain multiple instances of Swiz, the static methods on the Swiz class had to be removed. This means that code relying on static methods such as
Swiz.dispatchEvent() must be modified. In 1.0, event dispatching typically uses a dispatcher injected using the
[Dispatcher] metadata tag. This approach causes much less coupling to Swiz and results in a more flexible application. Full details on the event handling capabilities can be found in the Event Handling section.
[Autowire]metadata tag has been deprecated in favor of
[Autowire]will still function in 1.0 but it is recommended that you update your code to use