Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
Updating a Swiz 0.6.4 application to Swiz 1.0 will require the following changes:

h4. 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:

{html}<script src="http://gist.github.com/370722.js?file=swiz_064_main.xml"></script>{html}

In Swiz 1.0, this would look like:

{html}<script src="http://gist.github.com/370722.js?file=swiz_10_main.xml"></script>{html}

You might also note that several of the properties on Swiz have changed:

* the {{strict}} property has been renamed {{validateEventTypes}}, and now defaults to {{true}} so in most cases it can be removed
* {{mediateBubbledEvents}} has been removed since Swiz 1.0 mediates bubbled events automatically
* the {{beanLoaders}} property has been renamed to {{beanProviders}}, and has been moved to the {{Swiz}} class
* the {{eventPackages}} and {{viewPackages}} now accept package paths in both the format {{myapp.events}} and {{myapp.events.*}}. Note that you still need to specify child packages separately even if you use the .\* syntax.
* the {{injectionEvent}} property has been renamed {{setUpEventType}}, and now defaults to {{Event.ADDED_TO_STAGE}} instead of {{Event.PREINITIALIZE}}

Full details on configuration and the default values for 1.0 can be found in the [Configuration] section.

The {{BeanLoader}} class has been deprecated in favor of {{BeanProvider}}. {{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:
{html}<script src="http://gist.github.com/370670.js?file=Use_Dispatcher_Metadata.as"></script>{html}

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

h4. Other changes

* the {{\[Autowire\]}} metadata tag has been deprecated in favor of {{\[Inject\]}}. {{\[Autowire\]}} will still function in 1.0 but it is recommended that you update your code to use {{\[Inject\]}}.