Understanding Swift KeyPaths

Описание к видео Understanding Swift KeyPaths

In this video, I want to introduce you to KeyPaths and how you can use them in your Swift projects.

We will start by looking a what a KeyPath is and how you can use them to reference to a property of an object or a struct and then look at some examples of how you might apply them in your code.

This will include using keyPaths for sorting and mapping arrays, we will look at the DynamicMemberLookup attribute and two very practical examples for using KeyPaths to simplify your code

We will finish with a short explanation of how keyPaths are used in Lists for SwiftUI

If you want to support my work, you can buy me a coffee :)
https://ko-fi.com/stewartlynch

Table of Contents:
0:00 Introduction
1:14 The Basics
5:40 KeyPathComparator
8:22 KeyPaths for Mapping
9:46 DynamicMemberLookup
15:50 Practical Examples
22:52 KeyPaths in Swift Lists

Starter Project Files:
(If you are having problems downloading zip files, use Safari. Chrome restricts zip files by default)
https://www.createchsol.com/StarterPr...

Completed Project:
https://github.com/StewartLynch/Swift...

References mentioned in video:
What is Swift KeyPath in Swift
https://sarunw.com/posts/what-is-keyp...
How to Use DynamicMemberLookup in Swift
https://www.hackingwithswift.com/arti...
Higher order Function Videos
map, compactMap, flatMap
   • map, compactMap flatMap  
contains, forEach, Sorted
   • contains, forEach, sorted  
reduce, filter, removeAll
   • reduce, filter, removeAll  


Other References:
Stewart Lynch's YouTube Channel:
   / @stewartlynch  
Stewart Lynch on Mastodon:
https://iosdev.space/@StewartLynch
Stewart Lynch on Twitter:
  / stewartlynch  
Stewart Lynch on LinkedIn
  / stewartlynch  

Комментарии

Информация по комментариям в разработке