본문 바로가기
[android] ArrayMap 과 SparseArray 를 이용한 최적화 [android] ArrayMap 과 SparseArray 를 이용한 최적화 https://medium.freecodecamp.com/android-app-optimization-using-arraymap-and-sparsearray-f2b4e2e3dc47#.pg0eea2cx ArrayMap vs. HashMap -ArrayMap 은 android.util.ArrayMap 과 android.support.v4.util.ArrayMap 두 가지 형태가 있다.뒤의 녀석은 compat 이슈를 위한 것. -ArrayMap 은 HashMap 보다 더 memory 최적화된 데이터 구조를 가진다.ArrayMap 은 array 를 이용해 mapping 을 관리한다.Hash integer 를 가지고 있는 array 와,.. 2018. 3. 5.
[iOS] 앱이 지원하는 File Type 등록하고 처리하기 [iOS] 앱이 지원하는 File Type 등록하고 처리하기 -https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1 CFBundleDocumentTypes 를 Info.plist 에 포함시켜야 한다.이 key 에 대한 값은 dictionary 의 array 형태를 갖는다.각 dictionary 는 처리할 파일에 대한 정보를 갖는다.한 dictionary 에 여러 개의 파일 타입을 정의할 수도 있다.. 2018. 2. 20.
[ios] NSManagedObjectContextDidSaveNotification sent in todayExtension? [ios] NSManagedObjectContextDidSaveNotification sent in todayExtension? 참조 : https://www.innoq.com/en/blog/ios-writing-core-data-in-today-extension/ -context 를 여러 개 사용하는 경우에 context 에 대한 commit 분의 sync 를 맞춰주기 위해CoreData 는 내부적으로 NSManagedObjectContextDidSaveNotification noti 를 보내고,이를 addObserver 해놓은 곳에서는 mergeChangesFromRemoteContextSave 함수를 통해 sync 를 맞춘다. -그러나 todayExtension 에서 context 에 변화를 주었다.. 2018. 2. 10.
[Kotlin] Kotlin 의 숨겨진 비용 #3 [Kotlin] Kotlin 의 숨겨진 비용 #3 https://medium.com/@BladeCoder/exploring-kotlins-hidden-costs-part-3-3bf6e0dbf0a4 Delegated property -class Example{ var p: String by Delegate()} property 에 delegate 를 사용할 경우에 해당 delegate 는 operator function 인 getValue 와 setValue 를 구현해야 한다.해당 function 들은 object instance 와 property metadata 를 받는다. public final class Example{ @NonNull private final Delegate p$delegate =.. 2018. 1. 18.
[Kotlin] Kotlin 의 숨겨진 비용 #2 [Kotlin] Kotlin 의 숨겨진 비용 #2 https://medium.com/@BladeCoder/exploring-kotlins-hidden-costs-part-2-324a4a50b70 Local functions -local function 의 limit 은 inline 으로 정의될 수 없다는 것 ( 글 쓴 당시까지는, 현재버전에서 꼭 체크해보라 ).그리고 local function 을 가지고 있는 녀석도 inline 이 될 수 없다.fun someMth(a: Int): Int { fun sumSquare(b: Int) = (a+b) * (a+b) return sumSquare(1) + sumSqaure(2)} local function 은 Function object 로 바뀐다.public .. 2018. 1. 17.
[Objective-C] Foundation 프레임워크의 중요 클래스 - NSData, NSArray, NSSet [Objective-C] Foundation 프레임워크의 중요 클래스 - NSData, NSArray 9.3. 데이터 클래스 * 9.3.1. NSData -NSData 는 임의의 바이트 배열을 객체로 다루기 위한 랩퍼(wrapper) 이다. -일반적인 C 배열을 사용할 때와 비교했을 때의 장점은 객체로 추상화해서 다룰 수 있는 점,메모리 관리가 쉬운 점, Cocoa API 에서 바이트 배열을 다루는 표준이라는 점. -NSData 인터페이스는 한 번 작성되면 데이터 내용을 변경할 수 없다.데이터 내용을 나중에 변경하려면 NSMutableData 클래스를 사용해야 한다. -NSData 는 클래스 클래스터로 제공되므로 NSData 가 인스턴스의 직접 클래스가 아니라는 점, 일반 방법으로는 서브 클래스를 작성할.. 2017. 12. 31.
[iOS] Swift vs. Objective-C [iOS] Swift vs. Objective-C http://www.infoworld.com/article/2920333/mobile-development/swift-vs-objective-c-10-reasons-the-future-favors-swift.html -결론적으로 이 글은 Swift 가 더 좋음을 강조 -Swift 는 더 읽기 쉽다. Objective-C 는 기본적으로 C 베이스로 발전한 것이기 때문에 C 에서 예약한 keyword 를 사용할 수 없다.그래서 @ 를 이용한 keyword 를 사용하는데 가독성이 그리 좋지 않다. Swift 는 위의 @ keyword 관련 문제 뿐만 아니라statement 마지막의 세미콜론이 없어도 되고, conditional expression 에 ( ) 도.. 2017. 9. 13.
[Kotlin Tutorial] Annotation 과 Reflection #2 [Kotlin Tutorial] Annotation 과 Reflection #2 참조 : Kotlin in action 10.2. Reflection: introspecting Kotlin objects at runtime -Kotlin 에서의 reflection 은 java.lang.reflect package 의 API 들과 kotlin.reflect package 의 API 들을 사용한다.Kotlin 의 reflection 은 Java 에 없는 nullable type 이나 properties 들의 접근을 가능하게 한다. -runtime lib 의 size 를 줄이기 위해, kotlin 의 reflection API 는 kotlin-reflect.jar 라는 별개의 jar 로 pakcage 되어 있.. 2017. 9. 12.
[Kotlin Tutorial] Operator overload 와 convention #2 [Kotlin Tutorial] Operator overload 와 convention #2 출처 : Kotlin in action 7.3. Destructuring declarations and component functions -val p = Point(10, 20)val (x, y) = p // destructuringprintln(x)println(y) -destructuring 도 convention 을 사용한다.componentN 이 호출된다. ( N 은 숫자 )val (a, b) = p // val a = p.component1()// val b = p.component2() -data class 는 compiler 가 primaryConstructor 에 정의된 모든 property 에 .. 2017. 8. 29.
반응형