Implementation

개요 앞선 글에서 Delegates.observable이 어떻게 구현되었는지 살펴봤다. 이번 글에서는 이 구현을 간소화해서 필요한 부분만을 뽑아 옵저버 패턴을 구현해보고자 한다. 옵저버 패턴 직접 구현 해보기 1. Kotlin 변수의 변화를 인식하기 위한 interface 선언 Kotlin 변수의 변화를 인식하기 위해서는 operator fun getValue(thisRef: T?, property: KProperty): T, operator fun setValue(thisRef: T?, property: KProperty, newValue: T) 을 위임을 통해 다시 구현해야 한다. interface PropertyChangeListener { fun onPropertyChanged(oldValue: ..
· CI\CD/Gradle
implementation과 api, compile build.gradle에서 사용하는 implementation과 api는 모두 라이브러리를 적용시키는 키워드이다. 오래된 Gradle 버전에는 implementation이 없어서 compile을 사용했고, 새로운 버전(6.x 이후 버전)에서 compile이 deprecated 되면서 compile 대신에 api 키워드가 사용되게 되었다. 이 때문에 오래된 프로젝트들의 build.gradle 파일들을 보면 api와 compile을 implementation 대신 쓰는 것을 볼 수 있다. 즉, api와 compile은 같은 역할을 한다. 하지만 Gradle은 api나 compile를 사용하는 것을 권장하지 않는다. api를 통해 라이브러리를 가져올 경우 라..
Dev.Cho
'Implementation' 태그의 글 목록