iT邦幫忙

2023 iThome 鐵人賽

DAY 10
0

關於 Amplify iOS (ver.1)

  • 根據 AWS Amyplify 的文件,他們所提供的程式碼,包含了新舊兩版個兩種(總共四種寫法)
  • 前一篇所使用的是 v1
    Amplify iOS v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.
    
    Please use the latest version (v2) of Amplify Library for Swift to get started.
    
    If you are currently using v1, follow these instructions to upgrade to v2.
    
  • 原本的寫法,是基於 v1 的語法,再過不到一年,就過時了。所以趕緊來更新原始碼成 v2 吧!!

坑與除錯

  • 原本以為天上掉下來的程式碼,可以開心的無痛更新,但是新版這邊踩到了一個問題,見下圖:
    https://ithelp.ithome.com.tw/upload/images/20230911/20130149iucBmizZAk.png

AnyPublisher 是什麼?!

CombineAnyPublisher

  • 節錄文件內容
    The Combine framework provides a declarative Swift API for processing values over time. These values can represent many kinds of asynchronous events. Combine declares publishers to expose values that can change over time, and subscribers to receive those values from the publishers.
    
  • 大意是在講,Combine 框架 是一套宣告式的 Swift API 來處理隨著時間變化產生的
  • ,代表著諸多非同步事件的事件
  • Combine 透過宣告 Publishers 來取出與時推移的事件(值)。
  • 同理 Subscriber 就是拿來取值的。
    * The Publisher protocol declares a type that can deliver a sequence of values over time. Publishers have operators to act on the values received from upstream publishers and republish them.
    * At the end of a chain of publishers, a Subscriber acts on elements as it receives them. Publishers only emit values when explicitly requested to do so by subscribers. This puts your subscriber code in control of how fast it receives events from the publishers it’s connected to.
    

上一篇
【Day 9】 私房釣點地圖功能的重構:透過 Amplify 的 query 下載釣點
下一篇
【Day 11】 Amplify Storage: Using AWS S3 Storage Plugin
系列文
依然無法成為釣魚大師也要努力摸魚!!辣個吃魚神器 APP 第二彈33
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言