DKDaniel Kašajinarticles.danielkasaj.com·Dec 21, 2024 · 2 min readSwiftUI 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...00
DKDaniel Kašajinarticles.danielkasaj.com·Aug 26, 2023 · 2 min readTips for localizing SwiftUI appsI’ve recently localized my app Workout Shoes to German without ever touching the Localizable.strings file, and I’d like to share a few lessons learned: Let Xcode extract all the phrases for you Xcode has a menu command Product > Export Localizations…...01K
DKDaniel Kašajinarticles.danielkasaj.com·Aug 17, 2023 · 1 min readerror [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...00
DKDaniel Kašajinarticles.danielkasaj.com·Jul 12, 2023 · 1 min readExtend 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...00
DKDaniel Kašajinarticles.danielkasaj.com·Jun 23, 2023 · 1 min readPut 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 ...00