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
2.9k
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
1.8k
GraphQL放談
cockscomb
4
2k
GraphQL Highway
cockscomb
28
8.4k
吉田を支える技術
cockscomb
0
2.3k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.4k
ユーザインターフェイスと非同期処理
cockscomb
5
1.9k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.5k
あなたの知らない UIKit の世界 — UITableView に UITextView を置きたい
cockscomb
1
7.5k
Other Decks in Programming
See All in Programming
ReadMoreTextView
fornewid
0
250
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
510
Your Architecture as a Crime Scene:Forensic Analysis
manfredsteyer
PRO
0
100
CSC307 Lecture 17
javiergs
PRO
0
110
PT AI без купюр
v0lka
0
220
衛星の軌道をWeb地図上に表示する
sankichi92
0
260
Devinで実践する!AIエージェントと協働する開発組織の作り方
masahiro_nishimi
6
2.9k
OpenNext + Hono on Cloudflare でイマドキWeb開発スタックを実現する
rokuosan
0
120
Using AI Tools Around Software Development
inouehi
0
1.1k
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfold' relates to 'iterate'"
philipschwarz
PRO
0
180
複数アプリケーションを育てていくための共通化戦略
irof
9
3.7k
Zennの運営完全に理解した #完全に理解したTalk
wadayusuke
1
180
Featured
See All Featured
Making Projects Easy
brettharned
116
6.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Applications with DynamoDB
mza
95
6.4k
A better future with KSS
kneath
239
17k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Fireside Chat
paigeccino
37
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Practical Orchestrator
shlominoach
188
11k
GraphQLとの向き合い方2022年版
quramy
46
14k
Visualization
eitanlees
146
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
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/