Styling localized strings in Swift
How to render localized strings that contain mixed styling using either UIKit or SwiftUI.
Articles, podcasts and news about Swift development, by John Sundell.
How to render localized strings that contain mixed styling using either UIKit or SwiftUI.
Let’s take a look at Swift’s String API — why it’s designed the way it is, and how it deals with some of the challenges of accurately representing text in a modern app. Also, how to subscript a string, extracting and working with substrings, and how strings compare to other kinds of collections.
Michael Ilseman, developer on the Swift team at Apple, joins John to go on a deep dive into the String type, its implementation, and its related APIs. Topics range from the way Swift’s String API is designed, to its underlying complexities, and practical performance tips.
Being able to express basic values using inline literals is an essential feature in most programming languages. This week, let’s focus on string literals, by taking a take a look at the many different ways that they can be used and how we — through Swift’s highly protocol-oriented design — are able to customize the way literals are interpreted.
Almost every program on the planet has to deal with strings one way or another, since text is so fundamental to how we both communicate and represent various forms of data. This week, let’s take a look at various ways to parse and extract information from strings, and how different techniques and APIs will yield a different set of trade-offs.
In this first Daily WWDC Update we’ll try out an exciting new cross-platform framework called Natural Language. It provides a high-level API enabling easy access to a suite of language detection features when working with text in an app.
Swift 4 introduces a new, refined string API that is easier to use, more powerful, and gives the programmer more control in terms of memory management. This week, let’s take a look at how it is to work with strings in Swift 4, and how we can take advantage of the new, improved API in various situations.