Building REUSABLE SwiftUI components - Peter Friese | Swift Heroes 2023 Talk

  Переглядів 5,468

Swift Heroes

Swift Heroes

День тому

🎟️ 2024 ticket SPECIAL PRICE: swiftheroes.com/2024/
⏩ Chapter:
00:00 intro
02:56 The best way to build an app is with…
03:50 Hello world
06:01 Useful SwiftUI Refactorings
07:52 Peter’s Wishlist
12:26 Building a Reusable Text Input Field
14:04 Drop-in replacement for TextField
17:29 Customising Views
20:41 View Styling
22:09 Focus handling
22:42 Validation handling
24:56 - Exposing inner state
26:24 - Custom Validation
27:14 How to register Closures / Callbacks
28:04 Reusing the Component
31:15 Peter’s Wishlist
32:31 Live code Drop-in Replacement
36:38 Building a Reusable Text Input Field
📊 #SWIFTUI makes it easy to create beautiful UIs in no time, but it is just as easy to end up with a giant view that mixes view code and business logic.
🍏 Fortunately, Apple gave us some tools to keep the bloat in check and write maintainable and #reusable code.
🎬 In this #talk, I am going to show you how to:
- refactor an existing SwiftUI view to make it more maintainable
- turn it into a reusable SwiftUI component
- add event handling
- make the view configurable
- add it to the Xcode component library
- turn it into a shareable component that can be consumed via Swift Package Manager
- and distribute it via GitHub and the Swift Package Index
🎤 Peter Friese, Developer Advocate, Firebase
📍Swift Heroes 2023 was hosted in Turin, 4-5 May. Attended by 320 iOS developer participants and broadcast to an additional 320 Swift enthusiasts across the globe. The agenda covered a range of important iOS developer topics including SwiftUI, the composable architecture, accessibility, developer tools, testing and much more.
📌 For more engaging content and expert insights, subscribe to our channel and hit the notification bell. 🛎️
Inform: swiftheroes.com/
✅ Tweet: / swiftheroes_it
✅ Connect: / swift-heroes
✅ Read: telegram.me/swiftheroes
#SwiftHeroes #SwiftUI #UIDesign #AppDevelopment #ReusableComponents #Refactoring #MobileApp #SwiftUITutorial #CodingTips #iOSDev #SwiftProgramming

КОМЕНТАРІ: 14
@olegmyatlikov919
@olegmyatlikov919 Місяць тому
Thanks for the report Peter Friese! Very useful tips. I faced the same problems when I refactored my project from UIKit to SwiftUI. I wish this report was available when I did this. The report would save me a lot of time :)
@SwiftHeroes
@SwiftHeroes Місяць тому
Thanks for sharing! 👍
@chesterman18g
@chesterman18g Місяць тому
very good talk, Thank You Peter!
@SwiftHeroes
@SwiftHeroes Місяць тому
Glad you liked it! 🧡
@phukieu4238
@phukieu4238 24 дні тому
A question doesn’t relate to the topic, but I saw you inject service instance in Login View, so what is responsibility of LoginViewModel? It just keep state of Login View, right? 33:08
@caldera726
@caldera726 Місяць тому
Great video! I'm curious, is there a particular reason for not using a viewModel? Wouldn't this result in tighter coupling of Views, potentially reducing their reusability?
@PeterFriese
@PeterFriese Місяць тому
Hey @caldera726 - which part of the video are you referring to?
@trungnguyenthanh9233
@trungnguyenthanh9233 Місяць тому
Nice
@PawelPalczynski-VideoDayTM
@PawelPalczynski-VideoDayTM Місяць тому
Nice "input" 👏
@SwiftHeroes
@SwiftHeroes Місяць тому
Thanks! 😃
@Stricken174
@Stricken174 Місяць тому
i dont see any benefits of extract to functions, except when where is a switch. Extracted Text with modifiers doesnt make sense because its the same view with the same specs but with more lines of code.
@SwiftHeroes
@SwiftHeroes Місяць тому
Interesting observation, we asked peter to reply to you 😉
@PeterFriese
@PeterFriese Місяць тому
Keep in mind this is mostly to demonstrate the technique, so the example is deliberately simple. There are many cases where this makes sense and will make your code more maintainable.
@Stricken174
@Stricken174 Місяць тому
​@@PeterFriese acceptable) Don't think that I'm underestimate you) Common situation when extracting subviews is extracting them with all modifiers inside. So you're actually cant reuse it in the most cases. Designers nowadays can be the pain in the.. you know)
SwiftConf 2023 - Peter Friese: Building Reusable SwiftUI Components
44:14
Парковка Пошла Не По Плану 😨
00:12
Глеб Рандалайнен
Переглядів 12 млн
Your Brain 🧠 on Swift Concurrency - iOS Conf SG 2023
30:38
iOS Conf SG
Переглядів 6 тис.
Code push for Flutter with Shorebird - Felix Angelov
38:08
Flutter & Friends
Переглядів 696
SwiftConf 2023 - Paul Hudson: Level up your SwiftUI
43:16
SwiftConf
Переглядів 7 тис.
WWDC23: What’s new in SwiftUI | Apple
34:03
Apple Developer
Переглядів 44 тис.
Compose Multiplatform on iOS by: Sebastian Aigner and Nikita Lipsky
44:50
Kotlin by JetBrains
Переглядів 27 тис.
What it's like attending WWDC in Cupertino
55:12
Paul Hudson
Переглядів 6 тис.
How to use SwiftfulRouting in SwiftUI | Swift Packages #5
32:00
Swiftful Thinking
Переглядів 3 тис.
Marin Todorov - A 100% SwiftUI App | Swift Heroes 2023 talk
27:23
Swift Heroes
Переглядів 2,1 тис.
Это БЕСИТ ВСЕХ пользователей iPhone!!! 😡
28:07
Яблочный Маньяк
Переглядів 27 тис.
iPhone - телефон для нищебродов?!
0:53
ÉЖИ АКСЁНОВ
Переглядів 3,4 млн
300 000 за🚀МОЩНЫЙ, Но МЕРТВЫЙ ноут из Китая. Ремонт cyberpowerpc tracer 7 EDGE. Нюансы китай ноутов.
46:12
ААНТ КОНТАКТ Сервис по ремонту техники в ЕКБ, СПБ
Переглядів 60 тис.
Сомнительно... Ну Окэй... Распаковал Nothing Phone (2a)
16:19
РасПаковка ДваПаковка
Переглядів 54 тис.