🇺🇦 iOS Dev UA - спільнота iOS розробників
384 subscribers
399 photos
42 videos
9 files
961 links
Перша україномовна спільнота iOS розробників 🇺🇦

👨‍💻Цікаві матеріали зі світу розробки для продуктів Apple.
Статті по розробці на Swift та SwiftUI. Огляд нових технологій в розробці від Apple.

чат: @iOSDevsUAChat
Ідеї та пропозиції: @SergeyZhuravel
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
🚀Wow!! Калькулятор нарешті з’явиться на iPad з iPadOS 18, з розширеними функціями та інтеграцією Apple Pencil.

Новий додаток Calculator також буде доступний для всіх сумісних моделей і матиме узгоджений інтерфейс на всіх пристроях.

Спекуляції щодо відсутності додатка Calculator на iPad можуть бути пов’язані з філософією дизайну та пріоритизацією всередині Apple.

🇺🇦 iOSDevUA
This media is not supported in your browser
VIEW IN TELEGRAM
💡Створення анімації в стилі Siri в iOS 18

Siddhant Mehta та Meng To використовували комбінацію Mesh Gradient (приклад ви можете побачити у моєму пості вище) та ripple-ефекту.

🛠 Вихідний код проєкту доступний на GitHub.

📺 Сесія з прикладами анімацій ось тут.

🇺🇦 iOSDevUA
Hello iOS developers! New digest is here!

Hello everyone! New iOS weekly digest is here!
🚀🚀🚀 Last Week at Apple 🚀 🚀 🚀

SwiftUI, SwiftUI but what about UIKit? Jordan Morgan wrote an interesting article about UIKit improvements in iOS 18:
iOS 18: Notable UIKit Additions
https://www.swiftjectivec.com/ios-18-notable-uikit-additions

Why Swift's type checker is so slow
The Swift compiler can take an absurdly long time to compile expressions due to how types are inferred1. Here’s an explanation by the creator of Swift, Chris Lattner (from from his Mojo talk and edited for clarity):

My experience with Swift is we tried to make a really fancy bi-directional Hindley-Milner type checker and it’s really great because you can have very beautiful minimal syntax but the problem is that A) compile times are really bad (particularly if you have complicated expressions) and 😎 the error messages are awful because now you have a global constraint system and when something goes wrong you have to infer what happened and the user can’t know that something over there made it so something over here can’t type check. In my experience it sounds great but it doesn’t work super well:
https://danielchasehooper.com/posts/why-swift-is-slow

Mastering ScrollView in SwiftUI. Scroll Offset
WWDC 24 is over, and I decided to start writing posts about new features in the upcoming iteration of the SwiftUI framework. Apple continues filling gaps this year by introducing more granular control over the scroll position. This week, we will learn how to manipulate and read the scroll offset:
https://swiftwithmajid.com/2024/06/17/mastering-scrollview-in-swiftui-scroll-offset

Async await in Swift explained with code examples
Async await is part of the new structured concurrency changes that arrived in Swift 5.5 during WWDC 2021. Concurrency in Swift means allowing multiple pieces of code to run at the same time. This is a very simplified description, but it should give you an idea already how important concurrency in Swift is for the performance of your apps. With the new async methods and await statements, we can define methods performing work asynchronously:
https://www.avanderlee.com/swift/async-await

If you wondered how many Apple pays to OpenAI for ChatGPT integration, the answer is: zero:
https://www.macrumors.com/2024/06/13/apple-not-paying-openai-chatgpt-ios-18

And the last but not least - one hard thing for us as iOS and MacOS developers:
iOS 18 could ‘sherlock’ $400M in app revenue
This feels natural and probably good for end users but not for developers. Especially I can't understand when developers are happy about Apple "killed" some company or startup - we don't know when our app or company will be "killed" next:
https://techcrunch.com/2024/06/18/ios-18-could-sherlock-400m-in-app-revenue/
💡UIKitNavigation – бібліотека від Pointfree

За мотивами недавньої серії роликів про сучасну розробку на UIKit Pointfree випустили прев'ю бібліотеки UIKitNavigation, за допомогою якої можна керувати станом додатка, реалізовувати біндинги та навігацію за аналогією зі SwiftUI.

🇺🇦 iOSDevUA
1
💡NotPrivateAPIs — проєкт, який розкриває деякі приватні API

❗️Звичайно, їх не можна використовувати в робочих проєктах і викладати в App Store.

Наприклад, меню зі своїми елементами — це взагалі ще та задача (подивіться реакції в Messages над повідомленням, або реалізацію в телеграмі).

📖 Morris Richman зібрав в одному місці речі, які використовує Apple: наприклад, як додати кастомний хедер в UIAlertController або як змінити іконку додатка без попередження користувача.

🇺🇦 iOSDevUA
👍2
🤝 Готовий UI текстового форматера

Можна налаштувати, які дії скільки місця займають

Презентується як звичайний контролер. Управління через делегати

🇺🇦 iOSDevUA
Please open Telegram to view this post
VIEW IN TELEGRAM
👍2
💡NodeSwift – пакет для інтеропу Swift з Node.js

NodeSwift – пакет, за допомогою якого можна реалізовувати інтероп Swift з Node.js в обидва боки. Навіщо це взагалі може бути потрібно:

👉 Працювати з нативним кодом і macOS API в Electron-додатку
👉 Використовувати NPM пакети з Swift-додатку
👉 Прискорювати JS код, реалізуючи критичні частини на Swift

🇺🇦 iOSDevUA
💡Як iOS 18 покращує роботу з градієнтами

Дуже часто в проектах розробники використовують додатковий градієнт, щоб створити контраст між фоном і текстом.

Однак при такому використанні лінійного градієнта будуть видні перепади яскравості та різкий перехід.

📖 В iOS 18 доступне нове API для змішування кольорів. Тому, використовуючи UnitCurve, можна інтерполювати кольори за допомогою вбудованих або кастомних кривих Безьє, щоб забезпечити плавність переходу.

Приклад використання під катом:
extension Gradient {
init(from: Color, to:Color, with curve:UnitCurve, steps:Int = 10) {
let colors = stride(from: 0.0, through: 1.0, by: 1.0 / Double(steps))
.map { f in
from.mix(with: to, by: curve.value(at: f))
}
self.init(colors: colors)
}
}

📖 Додатково почитати про змішування кольорів можна в цій статті.

🇺🇦 iOSDevUA
🔥2
💡Правила створення класних анімацій

Рекомендації щодо того, як створювати красиві та корисні анімації. Більшість рекомендацій супроводжуються інтерактивними прикладами. Наприклад, можна пограти з різними параметрами spring-анімації, щоб відчути, при яких значеннях вона буде відчуватися максимально природньо.

🇺🇦 iOSDevUA
🚀Predictive code completion в Xcode 16 просто дивовижний

🇺🇦 iOSDevUA
😁4
💡Як керувати позицією скролу в SwiftUI

Одна з найбільш очікуваних нових фіч у SwiftUI – програмний скрол до будь-якої позиції. У статті розглядаються основні можливості нового API:

👉 Визначення позиції скролу як хардкодом, так і через позицію інших елементів.
👉 Біндинг позиції скролу до стейту.
👉 Анімування зміни скролу.

🇺🇦 iOSDevUA
💡Realm vs SwiftData: що швидше?

Jacob Bartlett з компанії Emerge Tools провів велике дослідження і порівняв продуктивність за трьома ключовими метриками:

1️⃣ Швидкість.
2️⃣ Розмір.
3️⃣ Пам’ять.

І хоча з точки зору запису та виконання простих запитів на читання Realm попереду, але в деяких моментах завдяки чудовому управлінню графами об’єктів при роботі з більш складними даними SwiftData виявилася продуктивнішою.

При невеликих обсягах (≤10 000 елементів, що охоплює переважну більшість сценаріїв у мобільних додатках) SwiftData також була набагато швидшою при оновленні існуючих даних.

📖 Багато графіків, висновків і цікавих особливостей можна дізнатися в цій статті.

🇺🇦 iOSDevUA
💡Helm – нативний додаток macOS для роботи з App Store Connect

Я здивований, що такий клієнт з’явився лише зараз. З появою у App Store Connect нормального API, ідея лежала на поверхні.
Що вміє додаток:

👉 Керувати білдами та користувачами в TestFlight
👉 Перевіряти статус білдів
👉 Перемикатися між різними командами
👉 Керувати локалізацією сторінки додатка та всіма ASO речами

🇺🇦 iOSDevUA
👍2
This media is not supported in your browser
VIEW IN TELEGRAM
В Xcode 16 ви можете створити новий файл зі свого буфера обміну! 🤯

🇺🇦 iOSDevUA
🔥3
This media is not supported in your browser
VIEW IN TELEGRAM
💡Створення ефекту переходу App Store за допомогою NavigationTransition в iOS 18

Цей ефект можна побачити, наприклад, у розділі «Сьогодні» або на 📺.

І якщо створення подібного переходу в iOS 18 може зайняти пару рядків коду, то повторення анімації з урахуванням усіх ефектів — значно складніше завдання.

📖 У цій статті Peter Friese поетапно розповідає, які моменти варто враховувати, і показує всі ітерації на прикладах коду.

🇺🇦 iOSDevUA
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1
This media is not supported in your browser
VIEW IN TELEGRAM
Нова фішка в Swift 5.9! 😀

Тепер ви можете використовувати if як вираз, що значно полегшує динамічне встановлення значення константи 👌

🇺🇦 iOSDevUA
🔥2
💡SwiftUI Tip

Рендер кількох view як одне складене представлення за допомогою модифікатора compositingGroup().

🇺🇦 iOSDevUA
3
This media is not supported in your browser
VIEW IN TELEGRAM
💡Створення динамічних текстових ефектів за допомогою TextRenderer

👨‍💻 Використовуючи метод draw протоколу TextRenderer, ми повинні виконати рендеринг на основі інформації про елементи, наданої Text.Layout в рамках GraphicsContext.

Нові функції в iOS 18 надають нам доступ до багатьох раніше недоступних деталей, таких як визначення того, чи обрізаний текст через властивість Layout’s isTruncated, кількість рядків, що відображаються після рендерингу, та конкретні дані про розташування тексту.

📖 У цьому матеріалі розглянуті не лише плюси, а й обмеження та складнощі роботи з анімацією загалом. А код можна подивитися ось тут.

🇺🇦 iOSDevUA
Hello iOS developers! New digest is here!

Hello everyone! New iOS weekly digest is here!

🚀🚀🚀 Last Week at Apple 🚀 🚀 🚀

What’s new in SwiftUI for iOS 18
We got new API for colors and gradients, more scrollview improvements, tab improvements, and more:
https://www.hackingwithswift.com/articles/270/whats-new-in-swiftui-for-ios-18

The rules of creating beautiful animations
People increasingly select their tools based on the overall experience rather than just functionality. A predictable and delightful experience is what makes a product stand out from a crowded market. That's why companies invest in design engineers for example. Animations can play a big role in creating such experiences:
https://emilkowal.ski/ui/great-animations

Mastering ScrollView in SwiftUI. Scroll Geometry
The ScrollPosition type is all you need to programmatically read or change the scroll position. Still, it doesn’t provide enough information when a user interacts with a scroll view using gestures. SwiftUI solves this problem by introducing the new ScrollGeometry type. This week, we will learn how to use the new onScrollGeometryChange view modifier to monitor scroll geometry:
https://swiftwithmajid.com/2024/06/25/mastering-scrollview-in-swiftui-scroll-geometry

Using TextRenderer to create highlighted text
TextRenderer is a new protocol introduced at WWDC 2024 which lets us enhance how text is rendered in SwiftUI. In this small post, I want to show how to create a view that enables you to highlight certain parts of a given String. Previously this was primarily done using NSAttributedString, but with TextRenderer it is now possible to do the same in a pure SwiftUI way:
https://alexanderweiss.dev/blog/2024-06-24-using-textrenderer-to-create-highlighted-text

Typed throws in Swift explained with code examples
Typed throws are new since Xcode 16 and allow you to define the type of error a method throws. Instead of handling any error, you can handle exact cases and benefit from compiling time checks for newly added instances. They were introduced and designed in Swift Evolution proposal SE-413.
I encourage you to read Try Catch Throw: Error Handling in Swift with Code Examples before diving into typed errors so you’re fully aware of the basics of error handling in Swift. This article will continue on the same path using similar code examples:
https://www.avanderlee.com/swift/typed-throws

Consolidated ViewState
Managing multiple states in SwiftUI views can be complex and error-prone. This post addresses the issue by introducing a consolidated generic ViewState enum, simplifying state management, reducing bugs, and enhancing maintainability:
https://www.ludafux.com/post/consolidated-viewstate

#Tools
Build with Xcode, Ship with Helm.
A native macOS app for App Store Connect that streamlines app updates and releases, making the process faster and easier:
https://helm-app.com/