본문 바로가기
반응형

코틀린8

코루틴(Coroutine) - Composing Suspending Functions 출처 : kotlinlang.org/docs/reference/coroutines/composing-suspending-functions.html 오늘도 열심히 코루틴에 대해 공부해 보겠습니다.!! Sequential by default 다음과 같은 간단한 suspend function 이 있습니다. suspend fun doSomethingUsefulOne(): Int { delay(1000L) // pretend we are doing something useful here return 13 } suspend fun doSomethingUsefulTwo(): Int { delay(1000L) // pretend we are doing something useful here, too return 29 .. 2020. 9. 20.
코루틴(Coroutine) - Cancellation and Timeout 이번에는 코루틴 Cancellation 과 Timeout에 대하여 알아보겠습니다. 장시간 동작하는 에플리케이션에서 필요없는 코루틴을 종료할 필요가 있습니다. 예를들어 특정 페이지를 닫으면 그 페이지에서 실행된 코루틴을 취소할 필요가 있습니다. 그럼 이 종료를 어떻게 하는지 알아보도록 하겠습니다. import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking fun main() = runBlocking { val job = launch { repeat(1000) { i -> println("job: I'm sleeping $i ...") delay(500L) } } delay(1300L.. 2020. 9. 13.
Firebase 전화번호 인증 사이드 프로젝트를 하면서 번호 인증을 Firebase를 통하여 적용하여 그때 공부한 내용을 적어봅니다. code및 공부 출처는 파이어베이스 입니다.(https://firebase.google.com/docs/auth/android/phone-auth?hl=ko#sign-in-the-user) 환경은 android, kotlin 입니다. 우선 기본적으로 firebase가 적용되어 있어야 합니다. 적용 방법은 app/build.gradle 에 다음을 추가합니다. implementation 'com.google.firebase:firebase-auth:19.3.2' 그리고 FirebaseConsole에서 프로젝트를 firebase와 연결 합니다. (이 부분은 나중에 기회되면 다시 글 써보도록 하겠습니다.) 파.. 2020. 9. 3.
TornadoFX를 사용하여 GUI 띄우기 [출처 - 이 글은 tornadofx-guide르 통해 공부한 내용을 정리한 글입니다. 더 정확한 내용은 https://edvin.gitbooks.io/tornadofx-guide/part1/2.%20Setting%20Up.html 에서 확인 하실 수 있습니다.] Kotlin 공부를 하다보면 항상 터미널을 사용해서 그 결과값을 확인합니다. 그럼 GUI를 띄우려면 어떻게하면 될까요? Kotlin 공식 싸이트의 Resouces를 확인해보면 TornadoFX라는 GUI Framework가 존재합니다. (더 많은 framework나 Library등을 확인해 보시려면 https://kotlinlang.org/docs/resources.html 2019. 8. 30.
반응형