Lets say you have instances of two data types, Comment and Annotation, that need to get saved to a Remote Store of some type.
- Comment object has two properties named as userid and message.
- Annotation object has four properties names userId, color, image and message.
- RPFirebase / RPGraphQL servers need unique app name, unique app id and unique app path from the app to initialize the server.
The above two objects (Comment / Annotation) need to get saved to a remote servers RPFirebase/RPGraphQL (not real Firebase/GraphQL).
Create a framework, which help us to send/export message (comment/annotation) to a remote server and integrate the framework into a main project. We can add this framework into all the project which has same requirement.
Framework must have the following capabilities:
- Framework can be used in multiple projects so we should not keep any credentials inside framework relates one project. Main project should have a capability to pass the credentials to framework and framework should work based on what it gets from the project.
- Flexibility to change from the existing server to a new server without changing the architecture.
- Capability to add a new server with minimal changes.
- Capabillity to add a new message type (like comment/annotation) without updating pattern.
Created a framework with all the above capabilities.
https://github.com/balasaida/MessageExporter
Added a framework into the project
https://github.com/balasaida/Exporter/tree/develop
MyExporter project demonstrates how to use the MyMessageExporter framework and helps you to understand the framework better.
- iOS 12.0+ | macOS 10.15.5+
- Xcode 11.3.1
To add the framework to your project. You should do
carthage update