Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UTI
Search
cockscomb
July 14, 2015
Programming
0
3k
UTI
Presented at potatotips 19
cockscomb
July 14, 2015
Tweet
Share
More Decks by cockscomb
See All by cockscomb
jq at the Shortcuts
cockscomb
1
2k
GraphQL放談
cockscomb
4
2.1k
GraphQL Highway
cockscomb
28
8.7k
吉田を支える技術
cockscomb
0
2.4k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.4k
ユーザインターフェイスと非同期処理
cockscomb
5
2k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.6k
あなたの知らない UIKit の世界 — UITableView に UITextView を置きたい
cockscomb
1
7.6k
Other Decks in Programming
See All in Programming
AgentCoreとHuman in the Loop
har1101
5
220
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
ThorVG Viewer In VS Code
nors
0
760
CSC307 Lecture 02
javiergs
PRO
1
770
dchart: charts from deck markup
ajstarks
3
990
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
490
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
180
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.8k
CSC307 Lecture 01
javiergs
PRO
0
690
Featured
See All Featured
Design in an AI World
tapps
0
140
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Scaling GitHub
holman
464
140k
The Language of Interfaces
destraynor
162
26k
Navigating Weather and Climate Data
rabernat
0
100
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Being A Developer After 40
akosma
91
590k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
52
Embracing the Ebb and Flow
colly
88
5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Transcript
UTI
cockscomb
None
None
gion-matsuri.jpg
ion-matsuri.jpg
JPEG
JPEG image/jpeg .jpeg public.jpeg
PNG image/png .png public.png
PNG image/png .png public.png Extension MIME Type UTI
File Types have many representations • Extension — .jpeg •
MIME Type — image/jpeg • UTI — public.jpeg
File Types have many representations • Extension • for file
name • MIME Type • for Internet (Content-Type) • UTI?
Uniform Type Identifier
Uniform Type Identifier • Used inside iOS/OS X • Have
inheritance • public.content/public.data → public.image → public.jpeg
let manager = PHImageManager.defaultManager() manager.requestImageDataForAsset(asset, options: options) { (data, dataUTI,
orientation, info) in // Do something } Get image data from Photos
let manager = PHImageManager.defaultManager() manager.requestImageDataForAsset(asset, options: options) { (data, dataUTI,
orientation, info) in // Do something } Get image data from Photos
UTI → Extension UTTypeCopyPreferredTagWithClass( "public.jpeg", kUTTagClassFilenameExtension ).takeRetainedValue() // jpeg
MIME Type → UTI UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, "image/jpeg", nil ).takeRetainedValue() //
public.jpeg
MIME Type → Extension func extensionFromMIMEType(MIMEType: String) -> String {
let uti = UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, MIMEType, nil ).takeRetainedValue() let ext = UTTypeCopyPreferredTagWithClass( uti, kUTTagClassFilenameExtension ).takeRetainedValue() return ext as String } extensionFromMIMEType("image/jpeg")
cockscomb/UTIKit
MIME Type → Extension func extensionFromMIMEType(MIMEType: String) -> String {
let uti = UTTypeCreatePreferredIdentifierForTag( kUTTagClassMIMEType, MIMEType, nil ).takeRetainedValue() let ext = UTTypeCopyPreferredTagWithClass( uti, kUTTagClassFilenameExtension ).takeRetainedValue() return ext as String } extensionFromMIMEType("image/jpeg")
MIME Type → Extension import UTIKit UTI(MIMEType: "image/jpeg").filenameExtension
Create your file type <array> <dict> <key>CFBundleTypeIconFiles</key> <array/> <key>CFBundleTypeName</key> <string>Awesome
File Format</string> <key>LSItemContentTypes</key> <array> <string>info.cockscomb.awesome</string> </array> </dict> </array>
Uniform Type Identifier • Can convert to file extension and
MIME Type • Can be simple to use with UTIKit ✌ • Can be defined your own one
৴ ౭ http://hatenacorp.jp/recruit/