Slide 1

Slide 1 text

,PUMJOॳ৺ऀ͕ (PPHMF1MBZ#JMMJOH-JCSBSZΛ ࢖ͬͯΈͨ ू·Ε,PUMJO޷͖ʂ,PUMJOѪ޷ձWPM #JU[$P -UEଜ্޾༤

Slide 2

Slide 2 text

$PDPBTXJGU w ΄΅ຖ݄ɺ஑ାίϫʔΩϯάεϖʔε0QFO0⒏DF '03&45Ͱ։࠵ͯ͠·͢ɻ w NBD04J04XBUDI04UW04"OESPJEϓϩάϥϚʔͷͨ ΊͷษڧձͰ͢ɻ w ϓϩάϥϜʹؔ͢Δ஌ࣝ΍ܦݧΛڞ༗Λ໨తͱ͍ͯ͠· ͢ɻ w ձͷ׆ಈ಺༰΍ൃදࢿྉɺαϯϓϧίʔυ͸ެ։Λલఏ ͱ͍ͯ͠·͢ɻ w ਃ͠ࠐΈ͸ɺDPOOQBTT͔Βɻ https://cocoa-kanto.connpass.com/

Slide 3

Slide 3 text

w ࡛ۄݝேբࢢͰιϑτϋ΢εΛىۀɻ w NBD04΍J04ɺ"OESPJEͷΞϓϦέʔγϣϯ։ൃΛओʹ੥͚ෛ͏ɻ w ࣗࣾΞϓϦͷ੡࡞ɻ w 5XJUUFS!N@ZVLJP w 'BDFCPPLZVLJPNVSBLBNJ w (JU)VCNVSBLBNJ w IUUQXXXCJU[DPKQXFCMPH

Slide 4

Slide 4 text

,PUMJOΛબΜͰΈ͕ͨ w "OESPJEͷୈҰڃͷαϙʔτݴޠ w 4XJGUͰ͖Ε͹΍ΕΔΑ w "QQMF΋ͦ͏͚ͩͲɺ(PPHMF΋,PUMJOFͰ৘ใΛ ग़͍ͯ͠ΔͷͰɺ,PUMJOͰ͠ΐ

Slide 5

Slide 5 text

(PPHMF1MBZ#JMMJOH-JCSBSZ 5SJWJBM%SJWFWαϯϓϧΞϓϦ

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

ߏ଄ʹ͍ͭͯ w ෳ਺ਓͰ։ൃ͢Δ৔߹ɺͲΜͳߏ଄ʹ͢Δͷ͔ܾ Ίͳ͍ͱ͍͚ͳ͍ɻ w ݸਓతʹ͸ɺγεςϜఏڙଆʢ(PPHMFʣ͕ਪ঑͢ Δ΋ͷΛૉ௚ʹ࠾༻Ͱ͍͍ͱࢥ͍ͬͯ·͕͢ɺ೉ ͍͠Ͱ͢Ͷɻ w ྫ͑͹ɺ"OESPJE+FUQBDLίϯϙʔωϯτ w -JWF%BUB΍7JFX.PEFͳͲ

Slide 9

Slide 9 text

Τϥʔͷѻ͍ w USZDBUDI͸ආ͚͍ͨɻ w TFBMFEDMBTTΛ࢖ͬͯɺ໭Γ஋ʹ݁Ռσʔλͱ Τϥʔ৘ใΛؚΊΔɻ w άϩʔόϧͳྫ֎ϋϯυϥΛར༻͢Δɻ https://github.com/Kotlin/KEEP/blob/master/proposals/ stdlib/result.md#error-handling-style-and-exceptions

Slide 10

Slide 10 text

sealed class FindUserResult { data class Found(val user: User) : FindUserResult() data class NotFound(val name: String) : FindUserResult() } fun findUserByName(name: String): FindUserResult { .... if (ݟ͔ͭͬͨ) return FindUserResult.Found(user) else return FindUserResult.NotFound(name) } val result = findUserByName("bitz") when (result) { is FindUserResult.Found -> println("find ${result.user}") is FindUserResult.NotFound ->println("find ${result.name}") } ϓϥΠϚϦίϯετϥΫλ ͜ΕܧঝͳΜͰ͢Ͷʂ

Slide 11

Slide 11 text

7JFX.PEFM

Slide 12

Slide 12 text

-JWF%BUB "OESPJE൛,FZ7BMVF0CTFSWJOH͔ -JWF%BUB 7JFX.PEFM $PDPBWFSTJPOPG.7$BTBDPNQPVOEEFTJHOQBUUFSO

Slide 13

Slide 13 text

IUUQTHJUIVCDPNBOESPJEQMBZCJMMJOHTBNQMFT class MakePurchaseFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { billingViewModel = ViewModelProviders.of(this).get(BillingViewModel::class.java) billingViewModel.purchasesLiveData.observe(this, Observer { it?.let { purchasesAdapter.setPurchases(it) } }) } } 7JFX.PEFM -JWF%BUB

Slide 14

Slide 14 text

class BillingViewModel(application: Application) : AndroidViewModel(application) { val gasTankLiveData: LiveData init { repository = BillingRepository.getInstance(application) repository.startDataSourceConnections() purchasesLiveData = repository.purchasesLiveData } override fun onCleared() { super.onCleared() repository.endDataSourceConnections() viewModelScope.coroutineContext.cancel() } } *O"QQ#JMMJOHػೳͷΫϥε ͷσʔλͱ7JFX.PEFMར༻ ଆΛ݁ͼ͚ͭΔ

Slide 15

Slide 15 text

class BillingRepository private constructor(private val application: Application) : PurchasesUpdatedListener, BillingClientStateListener { lateinit private var playStoreBillingClient: BillingClient val purchasesLiveData = mutableListOf>() fun demo() { purchasesLiveData.setValue(ߋ৽͢Δ஋) } } ࣮ࡍͷίʔυͰ͸ɺઌ΄Ͳͷ3FTVMUܕͰ੒ޭ ͳΒσʔλΛࣦഊͳΒΤϥʔ৘ใΛฦ͢Α͏ ʹͨ͠ɻ

Slide 16

Slide 16 text

No content