View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Bring expression to your app with Genmoji

    Discover how to bring Genmoji to life in your app. We'll go over how to render, store, and communicate text that includes Genmoji. If your app features a custom text engine, we'll also cover techniques for adding support for Genmoji.

    Capítulos

    • 0:00 - Introduction
    • 0:37 - Express yourself
    • 1:17 - Emoji enhancements
    • 2:17 - NSAdaptiveImageGlyph
    • 3:15 - Adopting in your app
    • 8:01 - Compatibility
    • 9:10 - Advanced usage
    • 10:33 - Wrap-up

    Recursos

    • Forum: UI Frameworks
    • WKWebView
    • AppKit
    • UIKit
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC24

    • What’s new in AppKit
    • What’s new in UIKit
  • Buscar neste vídeo...
    • 3:30 - Enable support for NSAdaptiveImageGlyph in a UITextView

      let textView = UITextView()
          textView.supportsAdaptiveImageGlyph = true
    • 4:41 - Read and write attributed string for serialization

      // Extract contents of text view as an attributed string
      let textContents = textView.textStorage
      
      // Serialize as data for storage or transport
      let rtfData = try textContents.data(from: NSRange(location: 0, length: textContents.length),
                    documentAttributes: [.documentType: NSAttributedString.DocumentType.rtfd])
      
      
      // Create attributed string from serialized data
      let textFromData = try NSAttributedString(data: rtfData, documentAttributes: nil)
      
      // Set on text view
      textView.textStorage.setAttributedString(textFromData)
    • 6:08 - Decompose and recompose an attributed string

      // Decompose an attributed string
      
      func decomposeAttributedString(_ attrStr: NSAttributedString) -> (String, [(NSRange, String)], [String: Data]) {
          let string = attrStr.string
          var imageRanges: [(NSRange, String)] = []
          var imageData: [String: Data] = [:]
          attrStr.enumerateAttribute(.adaptiveImageGlyph, in: NSMakeRange(0, attrStr.length)) { (value, range, stop) in
              if let glyph = value as? NSAdaptiveImageGlyph {
                  let id = glyph.contentIdentifier
                  imageRanges.append((range, id))
                  if imageData[id] == nil {
                      imageData[id] = glyph.imageContent
                  }
              }
          }
          return (string, imageRanges, imageData)
      }
          
      // Recompose an attributed string
      
      func recomposeAttributedString(string: String, imageRanges: [(NSRange, String)], imageData: [String: Data]) -> NSAttributedString {
          let attrStr: NSMutableAttributedString = .init(string: string)
          var images: [String: NSAdaptiveImageGlyph] = [:]
          for (id, data) in imageData {
              images[id] = NSAdaptiveImageGlyph(imageContent: data)
          }
          for (range, id) in imageRanges {
              attrStr.addAttribute(.adaptiveImageGlyph, value: images[id]!, range: range)
          }
          return attrStr
      }
    • 6:30 - Convert NSAttributedString to HTML

      // Converting NSAttributedString to HTML
      
      let htmlData = try textContent.data(from: NSRange(location: 0, length: textContent.length),
                     documentAttributes: [.documentType: NSAttributedString.DocumentType.html])
    • 7:33 - Support Genmoji in communication notifications

      func didReceive(_ request: UNNotificationRequest,
            withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
      
        ...
        let message: NSAttributedString = _myAttributedMessageStringWithGlyph
        let context = UNNotificationAttributedMessageContext(sendMessageIntent: sendMessageIntent,
                                                             attributedContent: _message)    
      
        do {
          let messageContent = try request.content.updating(from: context)
          contentHandler(messageContent)
        } catch {
          // Handle error
        }
      }
    • 9:45 - Render NSAdaptiveImageGlyph in custom typesetting solution

      // Find typographic bounds for image in NSAdaptiveImageGlyph
      
      let provider = adaptiveImageGlyph
      
      let bounds = CTFontGetTypographicBoundsForAdaptiveImageProvider(font, provider)
      
      // Draw it at the typographic origin point on the baseline
      
      CTFontDrawImageFromAdaptiveImageProviderAtPoint(font, provider, point, context)

Developer Footer

  • Vídeos
  • WWDC24
  • Bring expression to your app with Genmoji
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines