You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repo contains a sample address book application for iOS Swift that demonstrates how to use the DreamFactory REST API. It includes new user registration, user login, and CRUD for related tables.
5
+
6
+
#Getting DreamFactory on your local machine
7
+
8
+
To download and install DreamFactory, follow the instructions [here](http://wiki.dreamfactory.com/DreamFactory/Installation). Alternatively, you can create a [free hosted developer account](http://www.dreamfactory.com) at www.dreamfactory.com if you don't want to install DreamFactory locally.
9
+
10
+
#Configuring your DreamFactory instance to run the app
11
+
12
+
- Enable [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) for development purposes.
13
+
- In the admin console, navigate to the Config tab and click on CORS in the left sidebar.
14
+
- Click Add.
15
+
- Set Origin, Paths, and Headers to *.
16
+
- Set Max Age to 0.
17
+
- Allow all HTTP verbs and check the Enabled box.
18
+
- Click update when you are done.
19
+
- More info on setting up CORS is available [here](http://wiki.dreamfactory.com/DreamFactory/Tutorials/Enabling_CORS_Access).
20
+
21
+
- Create a default role for new users and enable open registration
22
+
- In the admin console, click the Roles tab then click Create in the left sidebar.
23
+
- Enter a name for the role and check the Active box.
24
+
- Go to the Access tab.
25
+
- Add a new entry under Service Access (you can make it more restrictive later).
26
+
- set Service = All
27
+
- set Component = *
28
+
- check all HTTP verbs under Access
29
+
- set Requester = API
30
+
- Click Create Role.
31
+
- Click the Services tab, then edit the user service. Go to Config and enable Allow Open Registration.
32
+
- Set the Open Reg Role Id to the name of the role you just created.
33
+
- Make sure Open Reg Email Service Id is blank, so that new users can register without email confirmation.
34
+
- Save changes.
35
+
36
+
- Import the package file for the app.
37
+
- From the Apps tab in the admin console, click Import and click 'Address Book for iOS Swift' in the list of sample apps. The Address Book package contains the application description, schemas, and sample data.
38
+
- Leave storage service and folder blank. This is a native iOS app so it requires no file storage on the server.
39
+
- Click the Import button. If successful, your app will appear on the Apps tab. You may have to refresh the page to see your new app in the list.
40
+
41
+
- Make sure you have a SQL database service named 'db'. Depending on how you installed DreamFactory you may or may not have a 'db' service already available on your instance. You can add one by going to the Services tab in the admin console and creating a new SQL service. Make sure you set the name to 'db'.
42
+
43
+
#Running the Address Book app
44
+
45
+
Almost there! Clone this repo to your local machine then open and run the project with Xcode.
46
+
47
+
Before running the project you need to edit API_KEY in the file Network/RESTEngine.swift to match the key for your new app. This key can be found by selecting your app from the list on the Apps tab in the admin console.
48
+
49
+
The default instance URL is localhost:8080. If your instance is not at that path, you can change the default path in Network/RESTEngine.swift.
50
+
51
+
When the app starts up you can register a new user, or log in as an existing user. Currently the app does not support registering and logging in admin users.
52
+
53
+
#Additional Resources
54
+
55
+
More detailed information on the DreamFactory REST API is available [here](http://wiki.dreamfactory.com/DreamFactory/API).
56
+
57
+
The live API documentation included in the admin console is a great way to learn how the DreamFactory REST API works.
0 commit comments