Refactore code to create ios framework