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

What is GEEK

Buddha Community

Introduction to MVVM with SwiftUI and Combine
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

Kirk  Keeling

Kirk Keeling

1625034480

SwiftUI MVVM Tutorial Build A News App in SwiftUI (SwiftUI MVVM, SwiftUI Combine,

Welcome back to the channel 👋🏾 In this swiftui tutorial we’ll be building a news app. We’ll learn how to use swiftui 2.0 with Combine, we’ll look into using SwiftUI MVVM, we’ll also interact with an API to get our newsfeed, use SPM(Swift Package Manager) to speed up our development flow and handle swiftui layout with views such as VStack. So stick around to learn something new and let’s build this swiftui news app.

Timestamps

00:00 Intro
00:36 Discussing lil api’s
01:31 Creating a new Xcode project
03:28 Setting up and creating our model
06:48 Setting up our API endpoint enum
10:08 Setting up our Errors
12:22 Creating our news service struct
24:55 Creating our ResultState enum
26:32 Creating our news viewmodel class
35:50 Using SPM (Swift Package Manager)
37:36 Laying out our ArticleView in SwiftUI
48:31 Laying out our ErrorView in SwiftUI
53:24 Hooking up our newsfeed to the API
01:00:09 Opening up links in SwiftUI
01:00:00 Testing our app
01:04:00 Wrapping up & Challenge

#swiftui #iosdev #iosdevelopment #swiftuitutorial

Twitter
https://twitter.com/tundsdev

Video Resources

Lil api
https://lil.software/api/

Postman
https://www.postman.com

Quicktype
https://app.quicktype.io

URLImage
https://github.com/dmytro-anokhin/url-image

Jordan Singer Socials

Site: https://lil.software
Github: https://github.com/jordansinger
Twitter: https://twitter.com/jsngr

#github #iosdevelopment #swiftui

Lulu  Hegmann

Lulu Hegmann

1591852200

Building an iOS app using SwiftUI + Combine + MVVM [Part 2]

This article guides you through building a complete app using only and exclusively those frameworks. Not only that, but we will also use a design pattern that has been gaining more and more traction in the Apple devs community.

#swiftui #combine #apple #ios #swift

Elliot  Bayer

Elliot Bayer

1632371460

How to Apply The MVVM Architecture Pattern To Weather App in SwiftUI

In this video we will learn how to apply the MVVM architecture pattern to our swiftui app. We will build a real world weather app as an example

#swift  #swiftui  #MVVM

SwiftUI Scratch Card Effect - Custom Masking - Animation's -View Builder-SwiftUI Tutorials

Hello Guys 🖐🖐🖐🖐
In this Video I’m going to show how to create a Stylish Scratch Card Animation Effect With Custom Masking in SwiftUI | Scratch to reveal content SwiftUI | SwiftUI Custom View Masking | SwiftUI Custom Animation’s | SwiftUI View Builder’s | SwiftUI Gesture’s | Xcode 12 SwiftUI.

► Source Code: https://www.patreon.com/posts/early-access-52075157

► Support Us
Patreon : https://www.patreon.com/kavsoft
Contributions : https://donorbox.org/kavsoft
Or By Visiting the Link Given Below:

► Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. It’s gives a great experience and I think you should give it a try too https://www.kite.com/get-kite/?utm_medium=referral&utm_source=youtube&utm_campaign=kavsoft&utm_content=description-only

► My MacBook Specs
M1 MacBook Pro(16GB)
Xcode Version: 12.5
macOS Version: 11.4 Big Sur

► Official Website: https://kavsoft.dev
For Any Queries: https://kavsoft.dev/#contact

► Social Platforms
Instagram: https://www.instagram.com/_kavsoft/
Twitter: https://twitter.com/_Kavsoft

► Timestamps
0:00 Intro
0:26 Building Home View
1:56 Building Scratch Card View(View Builder)

Thanks for watching
Make sure to like and Subscribe For More Content !!!

#swiftui #animation's #swiftui