@@ -21,7 +21,7 @@ logInController.delegate = self;
21
21
``` swift
22
22
var logInController = PFLogInViewController ()
23
23
logInController.delegate = self
24
- self .presentViewController (logInController, animated :true , completion : nil )
24
+ self .present (logInController, animated :true , completion : nil )
25
25
```
26
26
</div >
27
27
@@ -48,11 +48,11 @@ Any of the above features can be turned on or off. The options can be set using
48
48
| PFLogInFieldsDismissButton);
49
49
```
50
50
``` swift
51
- logInController.fields = [PFLogInFields.UsernameAndPassword ,
52
- PFLogInFields.LogInButton ,
53
- PFLogInFields.SignUpButton ,
54
- PFLogInFields.PasswordForgotten ,
55
- PFLogInFields.DismissButton ]
51
+ logInController.fields = [PFLogInFields.usernameAndPassword ,
52
+ PFLogInFields.logInButton ,
53
+ PFLogInFields.signUpButton ,
54
+ PFLogInFields.passwordForgotten ,
55
+ PFLogInFields.dismissButton ]
56
56
```
57
57
</div >
58
58
@@ -72,9 +72,9 @@ logInController.fields = (PFLogInFieldsUsernameAndPassword
72
72
| PFLogInFieldsTwitter);
73
73
```
74
74
``` swift
75
- logInController.fields = [PFLogInFields.UsernameAndPassword ,
76
- PFLogInFields.Facebook ,
77
- PFLogInFields.Twitter ]
75
+ logInController.fields = [PFLogInFields.usernameAndPassword ,
76
+ PFLogInFields.facebook ,
77
+ PFLogInFields.twitter ]
78
78
```
79
79
</div >
80
80
@@ -91,7 +91,7 @@ logInController.facebookPermissions = @[ @"friends_about_me" ];
91
91
var logInController = PFLogInViewController ()
92
92
logInController.delegate = self
93
93
logInController.facebookPermissions = [ " friends_about_me" ]
94
- self .presentViewController (logInController, animated :true , completion :nil )
94
+ self .present (logInController, animated :true , completion :nil )
95
95
```
96
96
</div >
97
97
@@ -112,11 +112,11 @@ When the user signs in or cancels, the `PFLogInViewController` notifies the dele
112
112
```
113
113
``` swift
114
114
func logInViewController (controller : PFLogInViewController, didLogInUser user : PFUser! ) -> Void {
115
- self .dismissViewControllerAnimated ( true , completion : nil )
115
+ self .dismiss ( animated : true , completion : nil )
116
116
}
117
117
118
- func logInViewControllerDidCancelLogIn ( controller : PFLogInViewController) -> Void {
119
- self .dismissViewControllerAnimated ( true , completion : nil )
118
+ func logInViewControllerDidCancelLog ( in controller : PFLogInViewController) -> Void {
119
+ self .dismiss ( animated : true , completion : nil )
120
120
}
121
121
```
122
122
</div >
@@ -146,15 +146,15 @@ You might want to use your own logo or background image. You can achieve this by
146
146
@end
147
147
```
148
148
``` swift
149
- class MyLogInViewController : PFLogInViewController {
149
+ class MyLogInViewController : PFLogInViewController {
150
150
151
151
override func viewDidLoad () {
152
152
super .viewDidLoad ()
153
153
154
- self .view .backgroundColor = UIColor. darkGrayColor ()
154
+ self .view .backgroundColor = . darkGray
155
155
156
- let logoView = UIImageView (image : UIImage (named :" logo.png" ))
157
- self .logInView .logo = logoView
156
+ let logoView = UIImageView (image : UIImage (named :" logo.png" ))
157
+ self .logInView ? .logo = logoView
158
158
}
159
159
160
160
}
@@ -172,7 +172,7 @@ logInController.signUpController = [[MySignUpViewController alloc] init];
172
172
``` swift
173
173
let logInController = MyLogInViewController ()
174
174
logInController.signUpController = MySignUpViewController ()
175
- self .presentViewController (logInController, animated : true , completion : nil )
175
+ self .present (logInController, animated : true , completion : nil )
176
176
```
177
177
</div >
178
178
@@ -272,11 +272,7 @@ signUpController.fields = (PFSignUpFieldsUsernameAndPassword
272
272
| PFSignUpFieldsDismissButton);
273
273
```
274
274
``` swift
275
- signUpController.fields = [PFSignUpFields.usernameAndPassword ,
276
- PFSignUpFields.signUpButton ,
277
- PFSignUpFields.email ,
278
- PFSignUpFields.additional ,
279
- PFSignUpFields.dismissButton ]
275
+ signUpController.fields = [.usernameAndPassword , .signUpButton , .email , .additional , .dismissButton ]
280
276
```
281
277
</div >
282
278
@@ -298,11 +294,11 @@ When the user signs up or cancels, the `PFSignUpViewController` notifies the del
298
294
```
299
295
``` swift
300
296
func signUpViewController (signUpController : PFSignUpViewController, didSignUpUser user : PFUser) -> Void {
301
- self .dismissViewControllerAnimated ( true , completion : nil )
297
+ self .dismiss ( animated : true , completion : nil )
302
298
}
303
299
304
300
func signUpViewControllerDidCancelSignUp (signUpController : PFSignUpViewController) -> Void {
305
- self .dismissViewControllerAnimated ( true , completion : nil )
301
+ self .dismiss ( animated : true , completion : nil )
306
302
}
307
303
```
308
304
</div >
@@ -338,10 +334,10 @@ class MySignUpViewController : PFSignUpViewController {
338
334
override func viewDidLoad () {
339
335
super .viewDidLoad ()
340
336
341
- self .view .backgroundColor = UIColor. darkGrayColor ()
337
+ self .view .backgroundColor = . darkGray
342
338
343
- let logoView = UIImageView (image : UIImage (named : " logo.png" ))
344
- self .signUpView .logo = logoView // 'logo' can be any UIView
339
+ let logoView = UIImageView (image : UIImage (named : " logo.png" ))
340
+ self .signUpView ? .logo = logoView // 'logo' can be any UIView
345
341
}
346
342
}
347
343
```
@@ -360,12 +356,12 @@ Often you will want to run some client-side validation on the sign up informatio
360
356
}
361
357
```
362
358
``` swift
363
- func signUpViewController (signUpController : PFSignUpViewController! ,
364
- shouldBeginSignUp info : [NSObject : AnyObject ] ! ) -> Bool {
365
- if let password = info? [" password" ] as? String {
366
- return password.utf16Count >= 8
367
- }
368
- return false
359
+ func signUpViewController (_ signUpController : PFSignUpViewController,
360
+ shouldBeginSignUp info : [String : String ] ) -> Bool {
361
+ if let password = info[" password" ] {
362
+ return password.utf16 . count >= 8
363
+ }
364
+ return false
369
365
}
370
366
```
371
367
` info ` is a dictionary that contains all sign up fields, such as username, password, email, and additional.
@@ -400,20 +396,20 @@ class MySignUpViewController : PFSignUpViewController {
400
396
override func viewDidLoad () {
401
397
super .viewDidLoad ()
402
398
403
- self .signUpView .usernameField .placeholder = " phone"
399
+ self .signUpView ? .usernameField ? .placeholder = " phone"
404
400
}
405
401
406
402
override func viewDidLayoutSubviews () {
407
403
super .viewDidLayoutSubviews ()
408
404
409
- self .signUpView .signUpButton .frame = CGRectMake (... ) // Set a different frame.
405
+ self .signUpView ? .signUpButton ? .frame = CGRectMake (... ) // Set a different frame.
410
406
}
411
407
412
408
}
413
409
```
414
410
</div >
415
411
416
- Developer interested in this kind of customization should take a look at the interface of [ ` PFSignUpView ` ] ( http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFSignUpView.html ) , where all customizable properties are documented.
412
+ Developers interested in this kind of customization should take a look at the interface of [ ` PFSignUpView ` ] ( http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFSignUpView.html ) , where all customizable properties are documented.
417
413
418
414
### Portrait and Landscape
419
415
0 commit comments