filmov
tv
Understanding Swift KeyPaths
![preview_player](https://i.ytimg.com/vi/2-fzccDtc7o/maxresdefault.jpg)
Показать описание
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 :)
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)
Completed Project:
References mentioned in video:
What is Swift KeyPath in Swift
How to Use DynamicMemberLookup in Swift
Higher order Function Videos
map, compactMap, flatMap
contains, forEach, Sorted
reduce, filter, removeAll
Other References:
Stewart Lynch's YouTube Channel:
Stewart Lynch on Mastodon:
Stewart Lynch on Twitter:
Stewart Lynch on LinkedIn
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 :)
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)
Completed Project:
References mentioned in video:
What is Swift KeyPath in Swift
How to Use DynamicMemberLookup in Swift
Higher order Function Videos
map, compactMap, flatMap
contains, forEach, Sorted
reduce, filter, removeAll
Other References:
Stewart Lynch's YouTube Channel:
Stewart Lynch on Mastodon:
Stewart Lynch on Twitter:
Stewart Lynch on LinkedIn
Комментарии