Phạm Trung Huyhuypham85.hashnode.dev·May 13, 2024Swift Code Explained: Implementing Safe Array SubscriptionWhen working with arrays in Swift, you might have come across a common error called “Fatal error: Index out of range”. This error typically occurs when you unintentionally try to access an index that is not present in the array. Actually, accessing e...15 likesSwift TipsiOS
Truong Nguyentruongnn.me·Apr 7, 2024Simplifying Array Initialization in Swift with Array(repeating:)When developing in Swift, a common requirement is to initialize an array where multiple elements share the same initial value. This scenario can arise in various contexts, such as setting up default configurations, pre-filling data structures, or ini...1 likeSwift
Phạm Trung Huyhuypham85.hashnode.dev·Mar 22, 2024Making a CompletionHandler Safer in SwiftAsynchronous programming in Swift often involves using completionHandler within functions to handle events. While this approach is common, there are potential pitfalls that developers need to be mindful of. One such pitfall is that there is no guaran...14 likes·26 readsSwift TipsiOS
Phạm Trung Huyhuypham85.hashnode.dev·Mar 17, 2024Stop Using .lowercased() to Compare Strings in SwiftWhen developing in Swift, a common task you may come across is comparing strings. However, did you know that using the .lowercased() method might not be the best way to do it? Let's take a look at an example where we compare two strings using .lowerc...20 likes·109 readsSwift Tipsswifttips