Client Persistence

Swiz provides two ways to help with client persistence. In both Flex and AIR projects you can use the SharedObjectBean. In AIR projects, you can also use the EncryptedLocalStorageBean, which can be found in the Swiz Desktop Extensions project on GitHub. (The EncryptedLocalStorageBean is kept in a separate project to avoid having a framework dependency on the AIR libraries.)


To use the SharedObjectBean, you simply declare it in a BeanProvider:

	<storage:SharedObjectBean id="soBean" />


Inject the instance into your model and declare a bindable getter/setter:

public var so:ISharedObjectBean;
public function get appIndex():int
	// the second parameter is the initial value
	return so.getInt("appIndex", 0);
public function set appIndex(index:int):void
	so.setInt("appIndex", index);