Keywords for new features of IOS9

Source: Internet
Author: User

////VIEWCONTROLLER.M//Common keywords for new features of 01-ios9////Created by Kun on 16/8/16.//copyright©2016 year Kun. All rights reserved.///*nullable:1, how to use (grammar) 2, when to use (function) nullable effect: possible for empty keyword purpose: To cater to Swift,swift is a strong language, Swift must specify whether an object is NULL keyword benefit: Improve code specification, Reduce communication costs Nullable Syntax 1 @property (nonatomic, Strong, nullable) NSString *name; Nullable Syntax 2 @property (nonatomic, strong) NSString *_nullable name; Nullable Syntax 3 @property (nonatomic, strong) NSString *__nullable name; *//*nonnull:1, how to use (grammar) 2, when to use (function) nonnull function: cannot be null nonnull Syntax 1 @property (nonatomic, Strong, nonnull) NSString *name; non Null Syntax 2 @property (nonatomic, strong) NSString *_nonnull name;  nonnull Syntax 3 @property (nonatomic, strong) NSString *__nonnull name; Null_resettable nonnull*//*null_resettable:1, how to use (syntax) 2, when to use (function) Null_resettable: An empty condition must be handled, overriding the Get method null_resettable function: The Get method cannot be empty, Set can be passed in as null keyword Objective: To cater to Swift,swift is a strong language, Swift must specify whether an object is NULL keyword benefit: Improve code specification, reduce communication cost Syntax 1 @property (nonatomic, Strong, Null_  resettable) NSString *name; *//*_null_unspecified: Not sure whether it is empty*//*The properties between the following two macros default to nonnull ns_assume_nonnull_begin ns_assume_nonnull_end*/#import "ViewController.h"@interfaceViewcontroller ()//Nullable//nonnull//null_resettable processing for empty conditions@property (Nonatomic, Strong, null_resettable) NSString *name;//@property (nonatomic, strong) NSString *_nullable name;//@property (nonatomic, strong) NSString *__nullable name;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; }-(NSString *) name{if(_name = =Nil) {_name=@""; }    return_name;}- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end

Keywords for new features of IOS9

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.