[SWIFT] I thought about the strategy of introducing Combine in iOS development

Introduction

――The framework has evolved with the version upgrade of iOS. With the advent of SwiftUI and Combine, it is time to change the UI construction method and architecture. However, it is not possible to rewrite all existing products immediately. This time, I thought about adding to the strategy for gradually migrating to the new framework.

Combine and Swift UI

――It's a new Swift UI, but I think there are high hurdles to implement a complicated UI with Swift UI. This is because SwiftUI has only been around for about two years, and the framework is in the process of evolution, and I feel that there is a large difference in the APIs that can be used with the iOS version. --Regarding Combine, the soil to be implemented by Reactive Programming such as RxSwift is already prepared to some extent, and both UIKit and SwiftUI can be supported. Furthermore, if you are already using RxSwift etc., the learning cost will be low and it will be easy to replace the existing one. ――From the above results, we will proceed with the introduction of Combine.

Introduced Combine

Change Target version to iOS 13

⭕️ --If you set the support version to iOS13, you can use it without any problems.

❌ ――You have to get the consent of the people concerned that the service is in operation.

Insert Open Combine

⭕️ --Easy to introduce --Works on iOS 13 and below --Combination and implementation can be implemented in the same way

❌ --Since it is added as a library, the binary size will increase. --I don't know if maintenance will be continued

Try to make your own only where you need it

⭕️ ――By making your own, it will be easier to understand the internal implementation. --You can control the range of influence yourself rather than using OpenCombine

❌ --Since you make your own, it costs learning depending on the demonstrator.

After introducing Combine

--Determine the architecture and implementation policy ――If you decide how to write it, it will be easier to maintain the code. -Implementing MVVM with SwiftUI and Combine --There are many samples on github, so it will be very helpful. - CombineCommunity/awesome-combine

Reference link

Recommended Posts

I thought about the strategy of introducing Combine in iOS development
[Java] I thought about the merits and uses of "interface"
About the basics of Android development
I thought about the best way to create a ValueObject in Ruby
I thought about an extension that can select the color of placeHolder in one shot with UITextFiled
[Ruby] I thought about the difference between each_with_index and each.with_index
I saw the list view of Android development collectively
About the problem of deadlock in parallel processing in gem'sprockets' 4.0
Review the multilingual support (i18n) of the ios app in 3 minutes
I learned about the existence of a gemspec file
iOS app development: Timer app (9. Customize the color of the progress bar)
Have you ever thought about the definition of "bad design"?
I compared the build times of various Dockerfiles in Rust
About the handling of Null
About the description of Docker-compose.yml
[Swift] I thought about compare
When I was worried about static methods in java interface, I arrived in the order of name interpretation
I want to change the value of Attribute in Selenium of Ruby
About the behavior of ruby Hash # ==
I read the source of ArrayList I read
I read the source of Integer
About the current development environment (Java 8)
I read the source of Long
About the role of the initialize method
Think about the 7 rules of Optional
I read the source of Short
I read the source of Byte
Order of processing in the program
I read the source of String
Summary about the introduction of Device
About the log level of java.util.logging.Logger
When updating my own application, I seriously thought about the package structure
I tried to summarize the key points of gRPC design and development
I stumbled upon the development and publication of my first iPhone app
[Ruby basics] About the role of true and break in the while statement
(Determine in 1 minute) About the proper use of empty ?, blank? And present?
About the continuous division method learned in the 4th grade of elementary school
I tried to make full use of the CPU core in Ruby
Android development, how to check null in the value of JSON object