본문 바로가기
[ios] Nullable & NonNull annotation [ios] Nullable & NonNull annotation -안드로이드에 보면 @Nullable, @NonNull 이라는 annotation 이 있어 API 사용에 대한 혜안을 주기 편리하다. -iOS 에도 있을까? -있다._Nullable 과 _Nonnull 이 그것이다. --(NSString* _Nullable)informationWithId:(NSString* _Nonnull)id; 위와 같은 문법으로 사용하면 된다. -_Nullable 과 _Nonnull 대신 nullable 과 nonnull 로 사용해도 된다.대신 이 경우에는 괄호의 처음에 온다.-(nullable NSString*)informationWithId:(nonnull NSString*)id; -property 에도 nullab.. 2017. 10. 30.
[Kotlin Tutorial] Kotlin 의 Type system - Chap6. The Kotlin type system [Kotlin Tutorial] Kotlin 의 Type system - Chap6. The Kotlin type system 출처 : Kotlin in action 6.1. Nullability 6.1.1. Nullable types -Kotlin 은 nullable types 를 지원한다.nullable type 이라는 것은 어떤 variable 이 null 을 가질 수 있는지를 명시하는 것이다. -nullable 하지 않은 곳에 null 을 넣으면 compile error 가 난다.기본 type 은 nullable 하지 않으며, nullable 을 만드려면 type 뒤에 ? 를 붙여주면 된다.어떤 타입이든 뒤에 ? 를 붙여줄 수 있다.fun strLenSafe(s: String?) = … 6.1.2.. 2017. 8. 18.
[android] 추가된 유용한 annotations [android] 추가된 유용한 annotations http://tools.android.com/tech-docs/support-annotationshttps://developer.android.com/reference/android/support/annotation/package-summary.html -Android support library 19.1 version 에서 annotation 들을 추가했다. -이 녀석을 사용하려면 gradle 에 다음을 추가해야 한다. compile ‘com.android.support:support-annotations:20.0.0’ 여기서는 크게 3가지 형태의 annotation 을 제공한다. 1. Nullness annotattions2. Resource ty.. 2017. 8. 2.
반응형