SwiftUI ScrollView Centered Items with ScrollTargetBehaviorLet’s make a ScrollView show a bunch of views horizontally, and center each one as the user scrolls, while also showing edges of adjacent ones. In a hurry to get the entire code? It’s at the bottom of the article. Any time a ScrollView scrolls, it c...2 min read·articles.danielkasaj.comDec 21, 2024
Tips for localizing SwiftUI appsYou don't ever have to touch Localizable.strings2 min read·articles.danielkasaj.com1KAug 26, 2023
error [PHPhotosErrorDomain] -1: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.)If you're seeing PHPhotosErrorDomain error -1 after attempting to add an image to Simulator via xcrun simctl addmedia <simulatorID> image.jpeg it might be because the image.jpeg is in a folder that is synced to your iCloud Drive. Just copy the file t...1 min read·articles.danielkasaj.comAug 17, 2023
Extend Swift types with static parameters for reuse, consistency, and faster codingI believe there comes a time when every developer adopts a technique for reusing common parameters. For years, I’ve been keeping all of my ”settings” in a single place i.e. which I would use like: label.textColor = GlobalSettings.darkRed direction...1 min read·articles.danielkasaj.comJul 12, 2023
Put Swift's Logger to good use: log everything & keep your console decluttered at the same timeLogger is an Apple framework available since Xcode 12 / iOS 14 and it’s the best way to track your app’s behavior. It offers various levels of logging — info, warning, error, and more — which you sprinkle around your code so that you can monitor the ...1 min read·articles.danielkasaj.comJun 23, 2023