Skip to content

Commit f0aecc3

Browse files
committed
Merge pull request #99 from TheAbstractDev/master
Updated README with a Swift Configuration exemple
2 parents ea5c626 + 3b76630 commit f0aecc3

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ You can use the REST API, the JavaScript SDK, and any of our open-source SDKs:
9191

9292
Example request to a server running locally:
9393

94-
```
94+
```curl
9595
curl -X POST \
9696
-H "X-Parse-Application-Id: myAppId" \
9797
-H "Content-Type: application/json" \
@@ -107,9 +107,10 @@ curl -X POST \
107107

108108
Example using it via JavaScript:
109109

110-
```
110+
```javascript
111111
Parse.initialize('myAppId','unused');
112112
Parse.serverURL = 'https://whatever.herokuapp.com';
113+
113114
var obj = new Parse.Object('GameScore');
114115
obj.set('score',1337);
115116
obj.save().then(function(obj) {
@@ -122,19 +123,27 @@ obj.save().then(function(obj) {
122123
```
123124

124125
Example using it on Android:
125-
```
126+
```java
126127
//in your application class
127128

128129
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
129-
.applicationId("myAppId")
130-
.clientKey("myClientKey")
131-
.server("http://myServerUrl/parse/") // '/' important after 'parse'
132-
.build());
133-
134-
ParseObject testObject = new ParseObject("TestObject");
135-
testObject.put("foo", "bar");
136-
testObject.saveInBackground();
137-
130+
.applicationId("myAppId")
131+
.clientKey("myClientKey")
132+
.server("http://myServerUrl/parse/") // '/' important after 'parse'
133+
.build());
134+
135+
ParseObject testObject = new ParseObject("TestObject");
136+
testObject.put("foo", "bar");
137+
testObject.saveInBackground();
138+
```
139+
Example using it on iOS (Swift):
140+
```swift
141+
//in your AppDelegate
142+
143+
Parse.initializeWithConfiguration(ParseClientConfiguration(block: { (configuration: ParseMutableClientConfiguration) -> Void in
144+
configuration.server = "https://<# Your Server URL #>/parse/" // '/' important after 'parse'
145+
configuration.applicationId = "<# Your APP_ID #>"
146+
configuration.clientKey = "<# Your CLIENT_KEY #>"
147+
}))
138148
```
139-
140149
You can change the server URL in all of the open-source SDKs, but we're releasing new builds which provide initialization time configuration of this property.

0 commit comments

Comments
 (0)