SwiftUI dev
1.2K subscribers
87 photos
38 videos
1 file
75 links
Mobile development, SwiftUI, Compose, feel free to reach me: @lexkraev

По вопросам рекламы: @lexkraev

Статистика/цены: @lexkraev_ads
Download Telegram
Must-have SUI-frame extension

Весьма удобные модификаторы, позволяющие избегать Spacer() и .frame(). Взял у Kavsoft :)
Забрать можно отсюда

Useful modifiers to avoid Spacer() and .frame(). Check out here.

#howto #getsources
This media is not supported in your browser
VIEW IN TELEGRAM
У LazyVGrid отсутствует возможность объединения столбцов.
Сделал пример, как можно это реализовать

LazyVGrid does not have a column span feature.
This tutorial demonstrate how we could implement it easily.

#howto #getsources
Проект с примерами различных анимаций на SwiftUI с лицензией бесплатного коммерческого использования.

A repository containing a variety of animations and Animated components created in SwiftUI that you can use in your own projects.

#howto #getsources
This media is not supported in your browser
VIEW IN TELEGRAM
Possible implementation of waterfall grid with row spanning-trick effect based on LazyVStack.

Реализация грида с ячейками разной высоты на LazyVStack.

#howto #getsources
This media is not supported in your browser
VIEW IN TELEGRAM
Implementation SwiftUI tab bar instead of UIKit’s.

Написал статью, как мы внедряли SwiftUI таб-бар взамен UIKit.

#readthis #howto
This media is not supported in your browser
VIEW IN TELEGRAM
Увидел этот пример в ленте linkedin (первоисточник — Eran Lunenfeld, который реализовал на jetpack compose). Решил воспроизвести сам 😊 Думаю, хороший челендж и пример для тестовых заданий на SwiftUI. Попробуйте сверстать сами: есть интересные моменты. Посмотреть код здесь

Saw this example in news feed on linkedin, author was Shai Mishali (who originally saw it from Eran Lunenfeld in his turn) and decided to reproduce myself ))
Think it was nice challenge ))
Try to make it yourself! Anyway code is here

#trytodo #howto #tasty #groovy #getsources
This media is not supported in your browser
VIEW IN TELEGRAM
По-умолчанию, если вы добавляете кнопку в ячейку, вся ячейка будет реагировать на action этой кнопки.

Для ожидаемого поведения используйте модификатор .buttonStyle(PlainButtonStyle()) (или .buttonStyle(BorderedButtonStyle()), доступный с iOS 15)

By default, if you add a button to a SwiftUI's cell, all the cell's area will react to button's action.

To fix this, use .buttonStyle(PlainButtonStyle()) modifier (or .buttonStyle(BorderedButtonStyle()) available from iOS 15)

#howto
Media is too big
VIEW IN TELEGRAM
Кастомизируем таб бар Код можно найти здесь

Customising and animating tab bar 🌊 using SwiftUI Code is here

#howto #tasty #groovy #getsources

@swiftui_dev
В SwiftUI отсутствует метод viewDidLoad(), самый близкий по смыслу: onAppear. Можно сэмулировать поведение viewDidLoad() следующим модификатором.

There is no viewDidLoad() equivalent method in SUI, the closest one is onAppear. Actually we can simulate viewDidLoad() behavior with custom modifier.

#howto
This media is not supported in your browser
VIEW IN TELEGRAM
Навигация

Один из блоков вопросов на iOS - собеседовании - архитектура приложений. При этом почти в любой архитектуре вопросы навигации всегда находятся сбоку от обсуждения. Более того, для навигации разрабатывают свои паттерны. Одними из таких являются координатор и навигатор.

Начиная с SwiftUI 1.0 Apple практически на каждом WWDC рассказывает про работу с MVVM, как будто забывая про роутинг. Да, нам показали NavigationView, NavigationLink, но не покидало ощущение, что Apple опять представили что-то промежуточное. Многие стали писать свои обертки над этим API, чтобы сделать работу удобнее. И наконец в iOS 16 Apple представили новое API навигации, которое так долго ждали.

Вместо NavigationView (deprecated) теперь нужно использовать NavigationStack. Экран для перехода будет определять модификатор navigationDestination.

Будем честны, многие команды до сих пор используют роутинг на UIKit в проектах на SwiftUI. Даже те, кто пытались разобраться в NavigationView, в конечном итоге возвращались обратно в UIKit. С появлением нового API навигации такой подход - поворот не туда. С другой стороны, новое API требует минимальный таргет у проекта iOS 16.0 . Что делать? Использовать бэкпорт! Можете создать свой тестовый проект, чтобы поработать с этой библиотекой. Мой сэмпл здесь.

#switfpm #howto #getsources #groovy
SwiftUI dev
Навигация Один из блоков вопросов на iOS - собеседовании - архитектура приложений. При этом почти в любой архитектуре вопросы навигации всегда находятся сбоку от обсуждения. Более того, для навигации разрабатывают свои паттерны. Одними из таких являются координатор…
Navigation

Hey guys! I’ve created test project with sample of new navigation API back ported in older SwiftUI versions.

One of the main question at every iOS-interview is app architecture. At the same time routing in the app almost always is the side theme of discussion. Moreover there are different approaches in the navigation in general and all of them have their own patterns such as navigator or coordinator.

Starting from SwiftUI 1.0 in almost every WWDC Apple talks about working with MVVM as if forgetting about routing. Yes, we were introduced to NavigationView, NavigationLink. But the feeling that Apple again has presented intermediate solution does not leave us. Some developers started to create their own wrappers over this API for convenience. Finally in iOS 16 Apple introduced the long-awaited new navigation API.

Instead of NavigationView (starting with iOS 16 it has been deprecated) we have to use NavigationStack. Now the navigationDestination modifier defines a view to display.

Frankly speaking many teams are still using UIKit routing in SwiftUI projects. Even those who tried to understand NavigationView, gave up and went back to UIKit. With the release of the new navigation API, this approach is a wrong turn. Apart from that the new API requires a minimum deployments as iOS 16.0. So what to do? Use a backport! Try my sample! You may create your own test project to try to work with this package using it.

#swiftpm #howto #getsources