タグ

Kotlinに関するharigelのブックマーク (3)

  • 【Kotlin】SharedFlow と BroadcastChannel | #iOS | #Android ファショ通

    Swift を身に付けていく過程の記録、最新ニュースや使い方、iPhoneMacAndroidPython なども。 👉 Shared flows, broadcast channels. See how shared flows made broadcast… | by Roman Elizarov | Medium 昔々、Kotlin に導入されたコルーチンは軽量でした。多数のコルーチンを起動しながら、恐怖の「変更可能な状態の共有」問題を避けながらコルーチン間で通信する方法が必要でした。 そこで、コルーチン間通信プリミティブとして Channel が追加されました。Channel は素晴らしく、コルーチン間の、1対1、1対多、多対1、多対多の通信をサポートし Channel に送信された値はすべて1回だけ受信されます。 Channel を使用して、イベントや状態の更新を複数のサ

    【Kotlin】SharedFlow と BroadcastChannel | #iOS | #Android ファショ通
    harigel
    harigel 2022/06/08
    channelの使い所 “加入者が現れるまで投稿されたイベントをすべて保持しなければならないという要件がある場合”
  • Shared flows, broadcast channels

    Photo by Davies Designs Studio on UnsplashOnce upon a time coroutines were introduced to Kotlin and they were lightweight. We could launch a multitude of coroutines and we needed a way to communicate between those coroutines without running into a dreaded “mutable shared state” problem. Thus Channel was added as an inter-coroutine communication primitive. The channels are wonderful. Channels suppo

    Shared flows, broadcast channels
    harigel
    harigel 2022/06/08
    “In the absence of a subscriber, any posted event is immediately dropped. ” "With the channel, ... Posted events are not dropped."
  • Kotlin + Retrofit2 + Gson で API 通信を実装する - 炊きたてのご飯が食べたい

    アクトインディ Advent Calendar 2016 18日目の記事になります。子どもとおでかけ情報アプリ「いこーよ」は、マップ上で簡単におでかけ先を探せる検索アプリです。記事を見てくれたパパさん、ママさん、ぜひ一度使ってみてください^^ iko-yo.net Kotlin 1.0.5 minSdkVersion 19 targetSdkVersion 25 この記事では Retrofit を使って API 通信をする際の、 http ヘッダーの追加方法や json を独自のモデルへ変更する方法などの基的なところを書きたいと思います。iOS の開発を担当していた頃は Swift + Alamofire + ObjectMapper で API 通信を実装していたのですが、 Retrofit もとても分かりやすく、導入が容易で素晴らしいライブラリだと思いました。 Retrofit のリ

    Kotlin + Retrofit2 + Gson で API 通信を実装する - 炊きたてのご飯が食べたい
  • 1