Rupert  Beatty

Rupert Beatty

1666261380

Clean Architecture for SwiftUI + Combine

Articles related to this project


Clean Architecture for SwiftUI + Combine

A demo project showcasing the setup of the SwiftUI app with Clean Architecture.

The app uses the restcountries.com REST API to show the list of countries and details about them.

Check out mvvm branch for the MVVM revision of the same app.

For the example of handling the authentication state in the app, you can refer to my other tiny project that harnesses the locks and keys principle for solving this problem.

Diagram

Key features

  • Vanilla SwiftUI + Combine implementation
  • Decoupled Presentation, Business Logic, and Data Access layers
  • Full test coverage, including the UI (thanks to the ViewInspector)
  • Redux-like centralized AppState as the single source of truth
  • Data persistence with CoreData
  • Native SwiftUI dependency injection
  • Programmatic navigation. Push notifications with deep link
  • Simple yet flexible networking layer built on Generics
  • Handling of the system events (such as didBecomeActive, willResignActive)
  • Built with SOLID, DRY, KISS, YAGNI in mind
  • Designed for scalability. It can be used as a reference for building large production apps

Architecture overview

Diagram

Presentation Layer

SwiftUI views that contain no business logic and are a function of the state.

Side effects are triggered by the user's actions (such as a tap on a button) or view lifecycle event onAppear and are forwarded to the Interactors.

State and business logic layer (AppState + Interactors) are natively injected into the view hierarchy with @Environment.

Business Logic Layer

Business Logic Layer is represented by Interactors.

Interactors receive requests to perform work, such as obtaining data from an external source or making computations, but they never return data back directly.

Instead, they forward the result to the AppState or to a Binding. The latter is used when the result of work (the data) is used locally by one View and does not belong to the AppState.

Previously, this app did not use CoreData for persistence, and all loaded data were stored in the AppState.

With the persistence layer in place we have a choice - either to load the DB content onto the AppState, or serve the data from Interactors on an on-demand basis through Binding.

The first option suits best when you don't have a lot of data, for example, when you just store the last used login email in the UserDefaults. Then, the corresponding string value can just be loaded onto the AppState at launch and updated by the Interactor when the user changes the input.

The second option is better when you have massive amounts of data and introduce a fully-fledged database for storing it locally.

Data Access Layer

Data Access Layer is represented by Repositories.

Repositories provide asynchronous API (Publisher from Combine) for making CRUD operations on the backend or a local database. They don't contain business logic, neither do they mutate the AppState. Repositories are accessible and used only by the Interactors.


Download Details:

Author: Nalexn
Source Code: https://github.com/nalexn/clean-architecture-swiftui 
License: MIT license

#swift #clean #architecture #swiftui 

What is GEEK

Buddha Community

Clean Architecture for SwiftUI + Combine
Rupert  Beatty

Rupert Beatty

1666261380

Clean Architecture for SwiftUI + Combine

Articles related to this project


Clean Architecture for SwiftUI + Combine

A demo project showcasing the setup of the SwiftUI app with Clean Architecture.

The app uses the restcountries.com REST API to show the list of countries and details about them.

Check out mvvm branch for the MVVM revision of the same app.

For the example of handling the authentication state in the app, you can refer to my other tiny project that harnesses the locks and keys principle for solving this problem.

Diagram

Key features

  • Vanilla SwiftUI + Combine implementation
  • Decoupled Presentation, Business Logic, and Data Access layers
  • Full test coverage, including the UI (thanks to the ViewInspector)
  • Redux-like centralized AppState as the single source of truth
  • Data persistence with CoreData
  • Native SwiftUI dependency injection
  • Programmatic navigation. Push notifications with deep link
  • Simple yet flexible networking layer built on Generics
  • Handling of the system events (such as didBecomeActive, willResignActive)
  • Built with SOLID, DRY, KISS, YAGNI in mind
  • Designed for scalability. It can be used as a reference for building large production apps

Architecture overview

Diagram

Presentation Layer

SwiftUI views that contain no business logic and are a function of the state.

Side effects are triggered by the user's actions (such as a tap on a button) or view lifecycle event onAppear and are forwarded to the Interactors.

State and business logic layer (AppState + Interactors) are natively injected into the view hierarchy with @Environment.

Business Logic Layer

Business Logic Layer is represented by Interactors.

Interactors receive requests to perform work, such as obtaining data from an external source or making computations, but they never return data back directly.

Instead, they forward the result to the AppState or to a Binding. The latter is used when the result of work (the data) is used locally by one View and does not belong to the AppState.

Previously, this app did not use CoreData for persistence, and all loaded data were stored in the AppState.

With the persistence layer in place we have a choice - either to load the DB content onto the AppState, or serve the data from Interactors on an on-demand basis through Binding.

The first option suits best when you don't have a lot of data, for example, when you just store the last used login email in the UserDefaults. Then, the corresponding string value can just be loaded onto the AppState at launch and updated by the Interactor when the user changes the input.

The second option is better when you have massive amounts of data and introduce a fully-fledged database for storing it locally.

Data Access Layer

Data Access Layer is represented by Repositories.

Repositories provide asynchronous API (Publisher from Combine) for making CRUD operations on the backend or a local database. They don't contain business logic, neither do they mutate the AppState. Repositories are accessible and used only by the Interactors.


Download Details:

Author: Nalexn
Source Code: https://github.com/nalexn/clean-architecture-swiftui 
License: MIT license

#swift #clean #architecture #swiftui 

Jackson George

1604649613

ECS: Residential & Commercial Cleaning Services in London

Specializing in commercial cleaning, office cleaning, hospital & GP surgery cleaning, residential cleaning, washroom cleaning, school cleaning, Covid cleaning and sanitization, ECS Commercial Cleaning Company London has built up a large, experienced team of highly-skilled team of professionals who ensures work is delivered to highest standards, on time and on budget.

At ECS Commercial Cleaning, we provide a safe, cost-effective and efficient service that covers all your commercial cleaning needs. From residential cleaning, washroom cleaning, school cleaning to office cleaning, hospital & GP surgery cleaning, we cater it all. We have years of experience with all kinds of projects and know the best approach to save you time and money. Our professional knowledge and skills has enabled us to provide high quality cleaning solutions throughout London.

We’ve been delivering commercial cleaning services throughout London with the help of trained and experienced professionals, using only the finest equipment and cleaning solutions. Our team starts cleaning project from initial consultation through to completion on budget and schedule.

ECS Commercial Cleaning strives to keep people first, investing in their professional training and safety. We work hard to create and sustain an environment that helps us to achieve clients’ expectations through consistently excellent service and minimal downtime.

Our Services

With 10 years of market experience, a resource of professional employees and coverage throughout the London, ECS Commercial Cleaning has established itself as one of the leading commercial cleaning company, offering valuable cleaning solutions including:

  • commercial cleaning
  • office cleaning
  • hospital & GP surgery cleaning
  • residential cleaning
  • washroom cleaning
  • school cleaning
  • covid cleaning and sanitization

Our clients are the London’s leading retail outlets, office buildings and office premises, schools, hospitals, production and industrial premises and others. Our cleaning solutions offers peace of mind to clients and most importantly ensure that workers are able to do their jobs comfortably and efficiently without compromising safety. Over the years of industry experience, we remain at the forefront of our industry due to our unparalleled customer dedication and unrivalled experience in providing safe, and cost-effective cleaning solutions.

Our Expert Team

ECS Commercial Cleaning provides you with an expert team that completes your cleaning project professionally and efficiently. No matter what cleaning service you require, our aim is to work closely with our clients in order to comprehend their needs and fulfil their specific requirements through tailored cleaning solutions.

With our eco-friendly cleaning products and a team of experienced professionals, we can provide timely cleaning solutions to our clients. Contact ECS Commercial Cleaning on 0161 5462235.

#cleaning #commercial cleaning #office cleaning #residential cleaning #washroom cleaning #covid cleaning and sanitization

Shawn  Durgan

Shawn Durgan

1593196500

Introduction to MVVM with SwiftUI and Combine

Over many years iOS Engineers have explored and experimented different architectural styles like MVC, MVVM, VIP, VIPER and many more. After 11 long years, Apple have decided to move away from an Event-Driven, Imperative UIKit to a State-Driven, Declarative SwiftUI. With SwiftUI’s State driven characteristic, along with Reactive Combine framework, MVVM fits in naturally as an architectural pattern.

Core components in MVVM

  • Model: It represents your domain model and contains all the business logic. It will not have any knowledge on how the view would be presented to user.
  • View: This is passive and doesn’t have any knowledge on business. It’s just a visual representation of ViewModel.
  • View Model: It represents a State of the View at any given point of time. It will also contain the Presentation logic. ViewModel transforms the Model in a way that view can consume directly. When there’s a change in the model, ViewModel informs View about the change, mostly through binding.

Let’s take a simple example of Stopwatch to architect our SwiftUI app with MVVM.

UI consist of:

  1. Text to show Time Elapsed.
  2. Below the Text we have two buttons. One to Start/Stop the Stopwatch and the other to record the Lap time.
  3. We also have a List to display all the recorded Lap times.

#combine #architecture #mvvm #swiftui #ios

Jackson George

1607673140

An Outstanding Office Cleaning and Commercial Cleaning Services London

Do you need to turn to a reputable company that offers an outstanding office cleaning and commercial cleaning services London? Maybe you need a DBS checked cleaners London? In either case, ECS Commercial Cleaning is the right choice for you. We are one of the best cleaning company ready to meet all your cleaning needs and will do so in a timely and efficient manner.

We offer office cleaning, commercial cleaning, and sanitisation and specialist cleaning London to our customers for either their home or business. We take pride in providing customized office cleaning and commercial cleaning services London, regardless the size of your facility. Our goal is to provide a 100% satisfactory experience and ensure your facility is sanitized, providing a productive and safe environment for employees and customers. We constantly stay on the cutting edge of technology to provide you with the best quality and most efficient cleaning services.

Skilled Cleaning Services

Our company has been providing skilled office and commercial cleaning services across London for over 10 years. Our experience, coupled with DBS checked cleaners London, has allowed us to make efficient use of the best processes, cleaning products, and supplies to get the job done quickly and effectively without any disruption. Whether you require regular or one-time cleaning services, we will customize cleaning program specifically according to your needs. ECS Commercial Cleaning has the resources and expertise to get the job done right the first time.

Professional Experts and Advanced Technology

We have DBS checked cleaners who are thoroughly trained and experienced in providing high quality cleaning services that dramatically decrease dust and bacteria, from your home and business. ECS Commercial Cleaning team is committed to making your home and business a cleaner and healthier place. With more than 10 years’ experience with providing office cleaning and commercial cleaning services, you can be confident that our team have all the skills required to provide hassle-free services.

Pursue the Highest Standards in Cleaning

At ECS Commercial Cleaning, we persistently follow the highest standards in sanitisation and specialist cleaning with customized programs designed to meet your needs. We have the tools and cleaning supplies to handle your cleaning and disinfecting responsibilities. Our customized cleaning plans make sure that you are getting the best service for the best price.

Our cleaning team is equipped to handle any project, big or small, at any time of day. Call us today at 0161 5462235 to learn more about how, ECS Commercial Cleaning can handle all your office cleaning and commercial cleaning responsibilities in London.

#office cleaning #commercial cleaning #cleaning #cleaning team

Office Cleaning Services Singapore | Nea Certified | Homeworz

Cleaning doesn’t mean mopping, vacuuming, and emptying trash bins. It has more significant values and procedures to place in order. When you hire professional office cleaning services, Singapore ensures that appropriate services are served to get your office back into a neat and tidy place. Experienced professionals ensure that all the hidden dust, dirt, allergens, and pathogens that remain in premises are eliminated appropriately.

Some Significant reasons to hire a professional cleaning service Singapore company over an ordinary one:

  • Analysation of the amount of work that needs to be done
  • Qualified staff that use their experience and knowledge
  • Cost-effective services with health safety promises
  • Accountability after work
  • Easy to approach and questioning if work is not performed appropriately
  • Bring Industry standards equipment into practice for quick and prompt services

What are some benefits of hiring professional office cleaning services in Singapore?

  1. Productivity
    Your employees feel more productive when they get a fresh, clean, and tidy working environment. Nobody wants to perform their duties where a clean working environment is not promoted. Bad and unclean surfaces may lead to serious health issues for people who work there.
    Furthermore, it is mandatory as per the government’s terms to keep the work environment efficient and clean for people who spend half of their valuable time to boost the business’s sales. Lately, a survey has found that more productivity can be obtained if organizations promote and support healthy work environment culture.

  2. Boost Sales
    Businesses are easy to open but hard to run appropriately due to high competition. However, a clean work environment is a small thing if you can take care of. In return, you may get double business to believe it or not. Lately, an incident occurred when a business owner performed hard duties but could not obtain huge clients.
    One day he approached an overseas client, and they agreed to visit the company’s office. The client found the premises well maintained, clean and admirable to perform work duties. The client was very impressed, and they signed the contract with the company to work together for upcoming years. Here the kudos goes to the owner who loved to keep the premises clean and office cleaning services Singapore performed cleaning duties.

  3. Long Tenure Cost Savings
    In general, most companies hesitate to hire professional cleaning services in Singapore. They have the ideology that such services are expensive and might hamper their office budget. But they seem far from reality. The truth is a regular cleaning employee-only vacuum; mop your floor and empty dustbins. Whereas professional service providers will perform ample work duties that include high and low dusting, thoroughly vacuuming carpets, mopping floors with adequate cleaning agents, remove dust from tables and blinds, and so on.

The Final Words
Your office is your pride, and you won’t want to demolish your satisfaction because of the inappropriate environment. So without having a second thought, opt for office cleaning services in Singapore today and see the difference.

#cleaning services singapore #carpet cleaning singapore #cleaning companies singapore #house cleaning singapore #office cleaning services singapore