The power of subscripts in Swift | Swift by Sundell
This article has been archived, as it was published several years ago, so some of its information might now be outdated. For more recent articles, please visit the main article feed. Using subscripting to access elements within various collections, like arrays and dictionaries, is something that’s very common not only in Swift — but in almost all relatively modern programming languages. However, the way subscripting is actually implemented in Swift is both quite unique, and really powerful — as it lets us add subscripting APIs to our own types, just like those found in the standard library. This week, let’s take a look at how subscripting works in Swift, and a few different ways to incorporate it into the way we design APIs — including some brand new capabilities that are being added in Swift 5.1. Arguably the biggest benefit of subscripting is the incredibly lightweight syntax that it gives us at the call site. Rather than having to call specific methods with names that we either need
This article has been archived, as it was published several years ago, so some of its information might now be outdated. For more recent articles, please visit the main article feed . The power of subscripts in Swift subscripts language features the power of Swift 5.0 Published on 18 Aug 2019 Using subscripting to access elements within various collections, like arrays and dictionaries, is something that’s very common not only in Swift — but in almost all relatively modern programming languages. However, the way subscripting is actually implemented in Swift is both quite unique, and really pow
related reading
- Property wrappers in Swift | Swift by Sundellswiftbysundell.com
- Swift: From Protocol to AssociatedType then Type Erasure | Welcome to Monstarlab’s Engineering Blogengineering.monstar-lab.com
- SwiftUI by Example - free quick start tutorials for Swift developershackingwithswift.com
- Building a menu using List - a free SwiftUI by Example tutorialhackingwithswift.com
- Simple Swift dependency injection with functions | Swift by Sundellswiftbysundell.com
- The Slice Type - The Rust Programming Languagedoc.rust-lang.org
- Swift Macros: Understanding Freestanding & Attached Macros - QuickBird Studiosquickbirdstudios.com
- SwiftUI MVVM Combine Example Made Easy: A Step-by-Step SwiftUI API Call Tutorialyoutube.com
- Getting started with associated types in Swift Protocols - SwiftLeeavanderlee.com
- @StateObject 和 @ObservedObject 的区别和使用 | OneV's Denonevcat.com
- Notes • Nick Arnernickarner.com
- Structs, Classes, and Actors in iOS Interviewsholyswift.app