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.8k
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.7k
GraphQL放談
cockscomb
4
1.9k
GraphQL Highway
cockscomb
28
8.2k
吉田を支える技術
cockscomb
0
2.1k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.3k
ユーザインターフェイスと非同期処理
cockscomb
5
1.8k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.4k
あなたの知らない UIKit の世界 — UITableView に UITextView を置きたい
cockscomb
1
7.3k
Other Decks in Programming
See All in Programming
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
cmp.Or に感動した
otakakot
2
130
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
320
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Amazon Qを使ってIaCを触ろう!
maruto
0
400
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Docker and Python
trallard
40
3.1k
GitHub's CSS Performance
jonrohan
1030
460k
A Tale of Four Properties
chriscoyier
156
23k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
How STYLIGHT went responsive
nonsquared
95
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Automating Front-end Workflow
addyosmani
1366
200k
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/