Presentation for Podlodka iOS Crew #9 - Modern iOS Coding

Overview

Struct oriented programming vs Protocol oriented programming

  • How do we use protocols
  • How to do it without protocols
  • How to transform any protocol to a sturct
  • Porotocol's limitations
  • Struct oriented programming's limitations
  • Play with uikit animations

Protocol oriented programming

protocol Animator {
    associatedtype Target
    static func animate(
        _ target: Target,
        completion: ((Bool) -> Void)?
    )
}

struct FadeInAnimator: AnimatorProtocol {
    static func animate(
        _ target: UIView,
        completion: ((Bool) -> Void)?
    ) {
        UIView.animate(
            withDuration: 5,
            delay: 0,
            options: [],
            animations: { target.alpha = 0.0 },
            completion: { completion?($0) }
        )
    }
}

Struct oriented programming

struct Animator<Target> {
    typealias Completion = (Bool) -> Void
    var animate: (Target, _ completion: Completion?) -> Void
}

extension Animator where Target == UIView {
    static func fadeOut(
        params: UIViewAnimationParams
    ) -> Animator {
        Animator { view, completion in
            UIView.animate(
                withDuration: params.duration,
                delay: params.delay,
                options: params.options,
                animations: { view.alpha = 0.0 },
                completion: { completion?($0) }
            )
        }
    }
}

Where does it use?

SnapshotTesting

There are two main entites which you should look at:

Diffing - allows to compare Values and convert them to and from Data

Snapshotting - allows to transform a snapshottable value into a diffable format (like text or an image) for snapshot testing.

More about it:

Resources

QRCode for this repository

You might also like...
Flixster-iOS - Flixster iOS Project for CodePath iOS Course
Flixster-iOS - Flixster iOS Project for CodePath iOS Course

Flixster-iOS Flixster iOS Project for CodePath iOS Course Flix Flix is an app th

iOS app that detects LaTeX symbols from drawings. Built using PencilKit, SwiftUI, Combine and CoreML for iOS 14 and macOS 11.

DeTeXt Finding the symbol you want to use in LaTeX can be hard since you can't memorize all the possible commands and packages for every symbol you mi

✨ Basic lists from iOS 2 to iOS 14
✨ Basic lists from iOS 2 to iOS 14

listapp.ios Basic lists on iOS ✨ UITableView iOS 2* Objective-C 2008 UITableView iOS 2* Swift 2008 diff UICollectionView iOS 6 2012 diff Compositional

ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript.
ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript.

ScriptWidget ScriptWidget is an iOS app that we can create widgets for iOS using JSX label style in JavaScript. Source code for ScriptWidget. Download

NetFun-ios-app - iOS app using BFF service to display processed data.
NetFun-ios-app - iOS app using BFF service to display processed data.

NetFun-ios-app iOS app using BFF service to display processed data. The iOS demo developed in SwiftUI and it uses BFF service to show expected UI comp

Super basic iOS app to browse open-source-ios-apps
Super basic iOS app to browse open-source-ios-apps

Super basic iOS app to browse open-source-ios-apps

An iOS application written in Swift to demonstrate how to implement a Clean Architecture in iOS

Reminders iOS An iOS application written in Swift to demonstrate how to implement a Clean Architecture in iOS. Idea The idea is to implement the simpl

IOS Dracker Payment - An iOS and React app to send/receive money and manage debt
IOS Dracker Payment - An iOS and React app to send/receive money and manage debt

An iOS and React app to send/receive money and manage debt. This app allows users to create transactions, add descriptions, tag images, tag notes, and manage them.

MyNews-iOS - A simple iOS mobile application for reading news articles
MyNews-iOS - A simple iOS mobile application for reading news articles

MyNews A simple iOS mobile application for reading news articles. This app uses

Owner
Evgenii Sukhanov
Evgenii Sukhanov
Joseph Heck 21 Dec 14, 2022
Robert Ciotoiu 0 Jan 24, 2022
Swift UI features and general iOS development coding lab

SwiftUI & iOS development concepts code lab Contains sample projects with documentation Overview SwiftUI provides views, controls and layout structure

Samuel Owino 4 Dec 14, 2022
Replit Coding App With Swift

ReplitCodingApp There is currently one bug currently in the app(that I know of): When going from the home view to a playground the number lines dont a

Abdel Rahman Elleithy 0 Nov 24, 2021
CultureCenter Netflix Clone Coding Dodo-Jayden

Netflix_CloneCoding CultureCenter Netflix Clone Coding Dodo-Jayden Git Commit Message 제목 50자이내 단어 형태로 종결 [작업태그] 작업사항 본문 80자 이내 단어 형태로 종결 작업 사항 설명 ex)

null 2 Jul 2, 2022
💥 a modern xkcd iOS client

XKCDY / app This is the source code of the XKCDY app. I built this app primarily as a way to learn Swift and SwiftUI. Because I was learning as I buil

null 32 Oct 30, 2022
A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture.

Coinz_App_iOS A demo app to showcase testable, modern iOS development with SwiftUI and Combine on MVVM-C architecture. Tech Stack: Swift, SwiftUI, Com

Burhan Aras 0 Dec 26, 2021
FSNotes is modern notes manager for macOS and iOS.

FSNotes FSNotes is modern notes manager for macOS and iOS. macOS app Key features Markdown-first. Also supports any plaintext and RTF files. Fast and

null 5.3k Dec 29, 2022
Demo implementing Modern MVVM with Combine and SwiftUI

ModernMVVM-Combine-SwiftUI Demo implementing Modern MVVM with Combine and SwiftUI Includes the following: Publishers feedback with needed extensions V

Ahmed M. Hassan 4 Dec 20, 2022
A modern front end for rpcs3, built in SwiftUI for macOS 12+

rpcs3-SwiftUI-macOS This is a SwiftUI wrapper for RPCS3 focused on bringing native SwiftUI support to the app for improved accessibility and performan

Team Puzel 2 May 4, 2022