Magic text is the perfect solution when you need to show a small amount of information in a pretty wrapper.
Going to Xcode File
> Add Packages...
and add the repository by giving the URL https://github.com/bullinnyc/MagicText
Enjoy!
import MagicText
let singleLineExampleText = "Life is like a box of chocolates, you never know what you’re gonna get."
let multiLineExampleText = """
Life is like a box
of chocolates, you never
know what you’re
gonna get.
"""
// Charmed magic text (default).
MagicView(
text: singleLineExampleText,
fontSize: 28
) {
print("Animation finished")
}
// Charmed magic text with different colors.
MagicView(
text: multiLineExampleText,
textColors: [.red, .orange, .yellow, .green, .blue, .black],
fontSize: 28,
delayStart: 5
) {
print("Animation finished")
}
// Art letter magic text.
MagicView(
text: singleLineExampleText,
textColors: [.black.opacity(0.7)],
fontSize: 28,
magicType: .artLetter
) {
print("Animation finished")
}
// Bubble magic text.
MagicView(
text: singleLineExampleText,
textColors: [.black.opacity(0.7)],
fontSize: 28,
magicType: .bubble
) {
print("Animation finished")
}
// Fantasy magic text.
MagicView(
text: singleLineExampleText,
textColors: [.black.opacity(0.7)],
fontSize: 28,
magicType: .fantasy
) {
print("Animation finished")
}
// Charmed letter magic text.
MagicView(
text: singleLineExampleText,
textColors: [.black.opacity(0.7)],
fontSize: 28,
magicType: .charmedLetter(backgroundColor: .blue)
) {
print("Animation finished")
}
Note: Default type is set to charmed
. You can try other types.
.charmed
.artLetter
.bubble
.fantasy
.charmedLetter
- iOS 14.0 +
- SwiftUI
- MagicText is distributed under the MIT License.