본문 바로가기
[ios] Objective-C 와 Swift 동시에 사용하기 [ios] Objective-C 와 Swift 동시에 사용하기 https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html Swift Code 에서 Objective-C 코드 사용하기-Swift Code 에서 Objective-C 코드를 쓰려면, Objective-C bridging header 가 필요하다.Xocde 는 Objective-C app 에서 Swift file 을 추가할 때, 혹은 그 반대일 때 이를 쉽게 만들 수 있도록 도와준다. 이 과정을 통해 만들어진 header 파일은 [productModuleName]-Bridging-Header.h 파일명을 갖는다. 이.. 2017. 12. 2.
[ios/tutorial] Core Data - Creating and Saving Managed Objects [ios/tutorial] Core Data - Creating and Saving Managed Objects https://developer.apple.com/library/watchos/documentation/Cocoa/Conceptual/CoreData/CreatingObjects.html#//apple_ref/doc/uid/TP40001075-CH5-SW1 Creating Managed Objects -NSManagedObject 는 Core Data 의 model object 이다.NSManagedObject 는 2개의 element 를 갖는다. entity description ( NSEntityDescription 과 managed object context ( NSManagedObjec.. 2017. 11. 6.
[Kotlin] Linkage Error 버그? [Kotlin] Linkage Error 버그? 현재 Kotlin version 1.1.4-2 를 사용하고 있는데 아래와 같은 버그가 있네요. class MyClass : Activity(){private var mIsResumed = false ...protected fun isResumed = mIsResumed} java.lang.LinkageError: Method boolean MyActivity.isResumed() overrides final method in class Landroid/app/Activity; .... 원인은 Activity class 에서 isResumed 라는 @hide 처리된 isResumed 라는 함수가 있다는 것..Compiler 가 웬만한 에러를 다 잡아준다는 똘.. 2017. 9. 13.
[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.
[Kotlin Tutorial] Kotlin 의 Type system #2 [Kotlin Tutorial] Kotlin 의 Type system #2 참조 : Kotlin in action 6.2. Primitive and other basic types 6.2.1. Primitive types: Int, Boolean, and more -Kotlin 은 primitive type 과 wrapper type 을 구분하지 않는다. -그렇다면 Int 가 object 라면 Kotlin 은 모든 primitive type 을 실제로 object 로 만드는가?당연히 그렇게 안 했다.compiler 가 대부분의 Int type 을 Java 의 primitive type 으로 변형시킨다.generic, collection 등은 원래 Java 의 Integer 형태만 담을 수 있으므로 이 경.. 2017. 8. 22.
[Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas [Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas 참조 : Kotlin in Action 5.1. Lambda expressions and member references 5.1.1. Introduction to lambdas : blocks of code as function parameters 5.1.2. Lambdas and collections -val people = listOf(Person(“Alice”, 29), Person(“Bob”, 31))println( people.maxBy{ it.age } ) // function 을 argument 로 받는다. { } 는 lambda syntax lambda 가 단순 functio.. 2017. 8. 16.
[Kotlin Tutorial] Kotlin 기초 #1 - Chap2. Kotlin basics [Kotlin Tutorial] Kotlin 기초 #1 - Chap2. Kotlin basics 참조 : Kotlin in Action 2.1. Basic elements : Functions and variables 2.1.1. Hello, world! -fun main(args: Array){ println(“Hello, world!”)} fun 는 function 을 정의하는 keywordtype 은 variable 이름 다음에 옴function이 class 정의 안에 있지 않아도 된다Array 가 class 이다 ( Java 는 아니징 ) -> Kotlin 에서는 모든 것이 Object 이다System.out.println 대신 println; (semicolon) 넣을 필요 없다 ( option.. 2017. 7. 25.
[Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why [Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why 참조 : Kotlin in Action -Kotlin 은 Java platform 을 targeting 한 새로운 프로그래밍 언어.Java 코드와 함께 쓰일 수 있다.Android 개발 뿐만 아니라 Server-side 개발에도 쓰일 수 있다. -Java 의 iib, framework 와 함께 쓰일 수 있고, Java 와 비교해 Performance 도 거의 동일하다. 1.1. A Taste of Kotlin -http://try.kotl.in 을 통해 코드 실습을 할 수 있다. -data class Person(val name: String, val age: Int? = null) fun main(args: A.. 2017. 7. 12.
[Effective Java] 작명 패턴보다는 주석(annotation)을 사용하자. [Effective Java] 작명 패턴보다는 주석(annotation)을 사용하자. - 1.5 배포판 이전에는 도구나 프레임워크에서 특별히 취급할 필요가 있는 프로그램 요소들을 나타내기 위해 작명 패턴(naming pattern)을 사용하는 것이 일반적. 예를 들어 JUnit 테스팅 프레임워크에서는 테스트 메소드들의 이름을 test로 시작하도록 하였다. 이 방법은 효과는 있지만 단점들이 있다. 1. 철자상의 오류로 인한 오류 2. 적합한 프로그램 요소에만 사용되는지 확신할 방법이 없다. 3. 매개 변수 값을 프로그램 요소와 연관시키는 좋은 방법을 제공하지 않는다. - 작명패턴의 단점은 annotation 을 사용하여 깔끔히 해결된다. - annotation 정의는 다음과 같이 한다. @Retention.. 2017. 1. 2.
반응형