Skip to content

Commit e5ec6ae

Browse files
TomWFoxflovilmart
authored andcommitted
Update code snippets (partially) to Swift 4.2 + Parse 1.7.2 (#582)
Changed PFACL.acl() to PFACL(), PFACL.setDefaultACL() to PFACL.setDefault()
1 parent e70b8a9 commit e5ec6ae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

_includes/ios/roles.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PFRole *role = [PFRole roleWithName:@"Administrator" acl:roleACL];
3131
```
3232
```swift
3333
// By specifying no write privileges for the ACL, we can ensure the role cannot be altered.
34-
var roleACL = PFACL.ACL()
34+
var roleACL = PFACL()
3535
roleACL.setPublicReadAccess(true)
3636
var role = PFRole.roleWithName("Administrator", acl:roleACL)
3737
role.saveInBackground()
@@ -83,8 +83,8 @@ wallPost.ACL = postACL;
8383
```
8484
```swift
8585
var moderators = /* Query for some PFRole */
86-
var wallPost = PFObject(className:"WallPost")
87-
var postACL = PFACL.ACL()
86+
var wallPost = PFObject(className: "WallPost")
87+
var postACL = PFACL()
8888
postACL.setWriteAccess(true, forRole:moderators)
8989
wallPost.ACL = postACL
9090
wallPost.saveInBackground()
@@ -102,9 +102,9 @@ wallPost.ACL = postACL;
102102
[wallPost saveInBackground];
103103
```
104104
```swift
105-
var wallPost = PFObject(className:"WallPost")
106-
var postACL = PFACL.ACL()
107-
postACL.setWriteAccess(true, forRoleWithName:"Moderators")
105+
var wallPost = PFObject(className: "WallPost")
106+
var postACL = PFACL()
107+
postACL.setWriteAccess(true, forRoleWithName: "Moderators")
108108
wallPost.ACL = postACL
109109
wallPost.saveInBackground()
110110
```
@@ -123,13 +123,13 @@ PFACL *defaultACL = [PFACL ACL];
123123
[PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];
124124
```
125125
```swift
126-
var defaultACL = PFACL.ACL()
126+
var defaultACL = PFACL()
127127
// Everybody can read objects created by this user
128-
defaultACL.setPublicReadAccess(true)
128+
defaultACL.hasPublicWriteAccess = true
129129
// Moderators can also modify these objects
130-
defaultACL.setWriteAccess(true, forRoleWithName:"Moderators")
130+
defaultACL.setWriteAccess(true, forRoleWithName: "Moderators")
131131
// And the user can read and modify its own objects
132-
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser:true)
132+
PFACL.setDefault(defaultACL, withAccessForCurrentUser:true)
133133
```
134134
</div>
135135

0 commit comments

Comments
 (0)