Text processing is an essential application for any computer language, and String is Swift’s powerhouse type for text handling. Strings are bi-directional collections of Character types that balance correctness, performance and ease…
…proper implementation of a string type in Swift has been a controversial topic for quite some time. The design is a delicate balance between Unicode correctness, encoding agnosticism, ease-of-use and high-performance. Almost every major release of Swift has refined the String type to the awesome design…
Game Tech
How to Translate Your Game Using the Unity Translation Package
Dec 14 2023 · Article (30 mins)
…translations not only of UI and other text but also of runtime assets. You’ll read about different ways to import localized strings from professional platforms in the XLIFF format before trying the free method for yourself with a Google Sheet integration. You’ll use a project from our Unity…
Multiple Domains
AttributedString Tutorial for Swift: Getting Started
Feb 28 2022 · Article (30 mins)
Building great-looking apps doesn’t rely on just images — it also extends to text. Different styles in attributed strings can go a great distance to making information more appealing. In this tutorial, you’ll learn about the new AttributedString value type introduced in iOS 15 and macOS…
…which contains the following code: import 'package:flutter/material.dart'; import 'cat_info.dart'; class CatBreedsPage extends StatefulWidget { // 1 const CatBreedsPage({Key key, this.title}) : super(key: key); final String title; @override State<CatBreedsPage> createState() => _CatBreedsPageState(); } class _CatBreedsPageState extends State<CatBreedsPage> { @override void initState() { super.initState(); } @override Widget build(BuildContext context…
Multiple Domains
Data Persistence on Flutter
Nov 6 2019 · Article (30 mins)
Persistence Can You Use Before you can save data onto a persistence layer, you need to encode it. Typically, representations such as a string or an array of bytes are needed because persistence layers do not usually know how to handle your classes or objects. Serialized Data and Encryption Serialization…
Android & Kotlin
Regular Expressions in Kotlin
Mar 14 2022 · Article (30 mins)
Learn how to improve your strings manipulation with the power of regular expressions in Kotlin. You’ll love them…
iOS & Swift
Swift Apprentice: Beyond the Basics
Apr 29 2025 · Book
…create a domain-specific language and compactly express complex values. In this chapter, you will implement a result builder for making fancy attributed strings…
Mirror is quite simple. You create a Mirror to reflect any instance you want to inspect. Consider the following code: struct User { let name: String let age: Int } let michael = User(name: "Michael Scott", age: 44) // Create the mirror let mirror = Mirror(reflecting: michael) Once you have the mirror object…
Flutter & Dart
Dart Apprentice: Beyond the Basics
Nov 9 2022 · Book
…this chapter, you'll go beyond a basic understanding of strings and learn how to modify them to your needs. This includes basic tasks like capitalization, adding or removing whitespace, splitting and joining, and replacing text in a string. You'll also learn to validate strings and extract text using…
…take these step-by-step. Create the URL for the request ➤ Add a new method to SearchViewController.swift: // MARK: - Helper Methods func iTunesURL(searchText: String) -> URL { let urlString = String( format: "https://itunes.apple.com/search?term=%@", searchText) let url = URL(string: urlString) return url! } This first builds a URL string by placing…
AI
Python for AI: A Crash Course
Nov 16 2024 · Multimodal Module (3 hrs, 37 mins)
…type from the value assigned to it. Here are some examples: score = 200 # int time_travel_gigawatts = 1.21 # float greeting = "Welcome to Python" # string is_user_logged_in = True # boolean Note: In Python, boolean values are capitalized: True and False, not true and false. Python doesn’t have constants, just…
iOS & Swift
SwiftGen Tutorial for iOS
Aug 2 2021 · Article (30 mins)
Learn how SwiftGen makes it easy to get rid of magic strings in your iOS projects…
iOS & Swift
Swift Metaprogramming: Writing Code that Inspects Itself
May 14 2026 · Article (15 mins)
Mirror is quite simple. You create a Mirror to reflect any instance you want to inspect. Consider the following code: struct User { let name: String let age: Int } let michael = User(name: "Michael Scott", age: 44) // Create the mirror let mirror = Mirror(reflecting: michael) Once you have the mirror object…
iOS & Swift
Swift Result Builders: Getting Started
Jun 12 2023 · Article (20 mins)
…best to dive right in. Create a file named CipherBuilder.swift. Add the following code: // 1 @resultBuilder // 2 enum CipherBuilder { // 3 static func buildBlock(_ components: String...) -> String { components .joined(separator: " ") .replacingOccurrences(of: "e", with: "🥚") } } You start with the @resultBuilder attribute, used to specify that the following definition is a result…
…this chapter, you’ll learn about strings and the way Dart represents text and characters using Unicode. You’ll also learn about concatenation and interpolation…
…start there, instead of at the welcome screen. You’ll also learn about how to store data in Swift dictionaries and realize that string manipulation is complicated. Data Persistence Depending on what type of data you’re saving, there are different ways of persisting your data: UserDefaults: Use this…
iOS & Swift
Swift Regex Tutorial: Getting Started
Feb 14 2023 · Article (30 mins)
Swift 5.7 made it easier to work with regular expressions. How to capture parts of the string you’re searching for. How to use RegexBuilder to construct a complex expression that’s easy to understand. How to load a text file that is poorly formatted into a data model…
Multiple Domains
Swift SDK for Android
May 31 2026 · Multimodal Module (3 hrs, 33 mins)
…minTitleLength = 3 private static let maxTitleLength = 50 private static let minDescriptionLength = 10 private static let maxDescriptionLength = 200 // 2 public static func validateTitle(_ title: String) -> Bool { let trimmed = title.trimmingCharacters(in: .whitespacesAndNewlines) return trimmed.count >= minTitleLength && trimmed.count <= maxTitleLength } // 3 public static func validateDescription(_ description: String) -> Bool…
iOS & Swift
SwiftUI Localization Tutorial for iOS: Getting Started
Dec 6 2021 · Article (20 mins)
SwiftUI localization tutorial, you’ll take advantage of internationalization and localization techniques in SwiftUI and iOS 15 by learning how to: Export and import strings from and to your project. Preview localizations while developing. Use new techniques to work with localized strings. Localize asset catalog items. Use Markdown to format…