Skip to content

Instantly share code, notes, and snippets.

@jamesporter
Created May 8, 2022 09:23
Show Gist options
  • Save jamesporter/62a851791d44e47c348b83b546fcff11 to your computer and use it in GitHub Desktop.
Save jamesporter/62a851791d44e47c348b83b546fcff11 to your computer and use it in GitHub Desktop.
Adding Noto Emoji to iOS (etc) app

Get from Webfonts

Download ttf and drag to project, add to target

In Application Target, Info add (the plus weirdly appears when you hover over another item πŸ€·β€β™‚οΈ).

Fonts provided by application (this will autocomplete)

and as item(s) e.g. NotoEmoji-SemiBold.ttf

Create CustomFont.swift or similar

import SwiftUI
enum CustomFont {
static let notoEmoji = "NotoEmoji-SemiBold"
}
struct Emoji: View {
var text: String
var size: CGFloat
var body: some View {
Text(text).font(Font.custom(CustomFont.notoEmoji, size: size))
}
}
struct Emoji_Previews: PreviewProvider {
static var previews: some View {
VStack {
Emoji(text: "πŸ˜‚πŸ˜¬πŸ˜”πŸ˜₯πŸ˜€", size: 32)
Emoji(text: "πŸ€·β€β™‚οΈπŸ˜±πŸŒŠ", size: 32)
Emoji(text: "πŸŽ‡πŸ”₯🚚πŸ’₯πŸŽ‰", size: 32)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment