🍏/iOS

[iOS] Apple Intelligence > Genmoji

eungding 2024. 7. 4. 20:54
728x90
반응형

https://developer.apple.com/apple-intelligence/

 

Apple Intelligence for Developers

Apple Intelligence is the personal intelligence system that puts powerful generative models right at the core of your iPhone, iPad, and Mac and powers incredible new features to help users communicate, work, and express themselves.

developer.apple.com

 

ㄴ Image PlayGround 는 세션도 없는데 아직도 여기 링크 추가안됨  😭   Genmoji 라도 해보자 

 

[ 환경 세팅 ]

 

Xcode 16.2 beta 릴리즈노트 에 이렇게 적혀있다. 

Known Issues

Apple Intelligence features are not supported on Virtual Machines and Simulators. (129198328)

 

 

즉 지금은 실기기 까지 세팅을 해야 테스트 해볼 수 있다. 

3종세트 준비

 

- 맥 OS 베타

- Xcode 베타

- 실기기 (아이폰 15pro 이상) > iOS 18 베타 

 

 

참고로 이제 폰에서 beta OS 다운받으려면 애플 디벨로퍼스 안들어가고 설정에서 바로 할 수 있다. 짱편!

 

 

 

[1] Genmoji  타입

 

unicode text 가 아닌 이미지이다.

 

 

 

그래서 이번에 NSAdaptiveImageGlyph 라는 타입이 새로 나왔다.

 

 

 

 

 

[2] 앱에 Genmoji 적용하기 

우선 위에서 말했듯이 유니코드가 아니라 ImageGlyph 이기 때문에  적절한 곳에 사용해야한다. 

예를들어 아래 체크친 항목들에 도입하기 적합하다. 

 

 

 

Genmoji 는 

 

- UITextView

- NSTextView

- WKWebView

- SwiftUI.Text 

 

에서 쓸 수 있다고 한다. 

 

let textView = UITextView()
textView.supportsAdaptiveImageGlyph = true

 

 

supportsAdaptiveImageGlyph  켜고 빌드해보면... 

 

 

~~~ TODO ~~~

아니?? Describe an Emoji 가 나와야하는데 Search Emoji 밖에 안나옴 ;;;; (나라, 언어변경해도..)

 

 

Writing Tools 같은 다른 Apple Intelligence 피쳐들도 아직 안됨 ;;;;

 

Xcode 16.2 beta 릴리즈노트  Apple Intelligence 시뮬레이터에서 안된다고 적혀있어서 실기기에는 서포트하는 줄 알았는데 아닌가봄... (iOS 18 Beta 2 릴리즈노트 )

 

 

일단 기록을 진행한다... 출시하면 실제 써보자... 

~~~~~~~

 

 

[3] Genmoji 저장, 불러오기

 

rtf data 로 저장하고 불러오면 됨. (rtf 는 rich text format 을 의미)

 

참고: NSAttributedString > DocumentType > rtf 

 

 

 

[4] Genmoji  다른 플랫폼 대응은 ? 

iOS 로컬에서만 쓰는 텍스트가 아니라면 어떻게 하나?

웹과 안드에서도 동일하게 보여져야한다면? 

 

인라인 이미지로 다루라고 한다. 

 

 

 

rtf data 를 html 로 컨버팅하면

html 에서 저렇게 type 은 image-glyph 해서 보여진다고 한다. 

 

 

근데 이건 Webkit 처럼 apple-adaptive-glyph type 을 지원하는 엔진일 때

이렇게 inline image 로서 genmoji를 보여줄 수 있는 것이고

 

image glyphs 를 지원안하는 엔진은 fallback image 가 보여질 것이라고 한다. 

fallback image 는 아랫 줄에 있는 <img src="genmoji.png" ...>  이미지를 말한다.

 

This will emit cross-compatible HTML so advanced engines that support the "apple-adaptive-glyph type", such 
as Webkit, will display the image inline with text as if it were a standard emoji. For engines that don’t support 
image glyphs, this fallback image will be displayed instead.

 

 

 

ㄴ 웹브라우저랑 안드 대응 괜찮을까 ?  

 

[5] Genmoji  iOS 18 미만 에서는 ? 

 

NSAdaptiveImageGlyph 타입은 iOS 18+ 부터인데 하위버전에서는 어케될까. 

자동으로 Text attachment 타입으로 fallback 된다고 한다.

 

 

 

ㄴ 자동으로 비슷한 이모지로  fallback 된다는 건지, 기본 물음표가 보여진다는 건 지 잘 이해못했음. 테스트해보자. 

 

 

 

contentDescription 텍스트라도 보여주는게 좋은 사용성이다. 

 

 

 

 

 

 

[6] Genmoji 노티 메세지 에서도 쓸 수 있음 

 

UNNotificationAttributedMessageContext

 

 

 

 

[ Reference ]

 

https://developer.apple.com/videos/play/wwdc2024/10220/

 

Bring expression to your app with Genmoji - WWDC24 - Videos - Apple Developer

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...

developer.apple.com

 

 

 

반응형