added flow/mode/state concepts to application module. moved ios source into platform specific module