iOS: A few code modernizations

This commit is contained in:
Jonathan Schleifer 2017-11-26 20:19:07 +01:00
parent ccc0706caa
commit f886262722
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
8 changed files with 46 additions and 33 deletions

View file

@ -54,18 +54,18 @@ showAlert(UIViewController *controller, NSString *title, NSString *message)
- (IBAction)done: (id)sender
{
OFString *name = [self.nameField.text OFObject];
OFString *lengthStr = [self.lengthField.text OFObject];
OFString *name = self.nameField.text.OFObject;
OFString *lengthString = self.lengthField.text.OFObject;
bool lengthValid = true;
size_t length;
if ([name length] == 0) {
if (name.length == 0) {
showAlert(self, @"Name missing", @"Please enter a name.");
return;
}
@try {
length = (size_t)[lengthStr decimalValue];
length = (size_t)lengthString.decimalValue;
if (length < 3 || length > 64)
lengthValid = false;