You can’t convert an integer directly to a Character
instance, but you can go from integer to UnicodeScalar
to Character
and back again:
let startingValue = Int(("A" as UnicodeScalar).value) // 65
for i in 0 ..< 26 {
print(Character(UnicodeScalar(i + startingValue)))
}
More Related Contents:
- Find out if Character in String is emoji?
- How add separator to string at every N characters in swift?
- Max length UITextField
- How to create a hex color string UIColor initializer in Swift? [duplicate]
- Set the maximum character length of a UITextField in Swift
- What is the difference between Int and Int32 in Swift?
- Expected declaration error for making high score [duplicate]
- Could not insert new outlet connection: Could not find any information for the class named
- The app delegate must implement the window property if it wants to use a main storyboard file swift
- Changing tab bar item image and text color iOS
- Loading ViewController from xib file
- The default app has not been configured yet
- Set UITableView’s height to the height of its content with Auto Layout
- SwiftUI: Translucent background for fullScreenCover
- Accessing variables from another ViewController in Swift
- Xcode 10 build fails with ‘Command CompileSwift failed with a nonzero exit code
- How to only disable scroll in ScrollView but not content view?
- How to get a Swift type name as a string with its namespace (or framework name)
- How to filter Firebase data in Swift?
- Swift – Checking unmanaged address book single value property for nil
- How do you properly order data from Firebase chronologically
- ios swift: Is it possible to change the font style of a certain word in a string?
- Swift/SpriteKit Multiple Collision Detection?
- Duplicate Symbol Error in NSManagedObject Subclass
- Ambiguous use of subscript xcode 7.1
- SwiftUI: Error in dragging logic or is this a bug?
- Have a variable with multiple types in Swift
- uicollectionview remove top padding
- Spritekit – not loading @3x images from SKTextureAtlas
- How to make iPhone vibrate using Swift?