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
SwiftFriendlyObjective-C/try! Swift Tokyo 2017 ...
Search
Noritaka Kamiya
February 28, 2017
Programming
1
850
SwiftFriendlyObjective-C/try! Swift Tokyo 2017 RejectCon
https://rmp-quipper.connpass.com/event/49316/
Noritaka Kamiya
February 28, 2017
Tweet
Share
More Decks by Noritaka Kamiya
See All by Noritaka Kamiya
キラリと光るテクニック、アプリをデモするときの心構え/iOSDC Japan 2018
nolili
4
3.2k
WWDC Pre meeting
nolili
1
3.3k
FastLane with Swift
nolili
0
140
App Transport Securityとローカルネットワーキング/iOSDC Japan 2017
nolili
1
1.4k
iOS Test Night #4
nolili
0
3.8k
iOSアプリ開発のCI/CD環境とユビレジでのtry / CI CDNight
nolili
1
1.7k
ユビレジiOSアプリ開発のCI/CD環境 / iOS Test Night #1
nolili
5
2.3k
Modern Core Data(iOS 10)
nolili
0
1.3k
iOS I/O 2016 アクセサリといっしょ
nolili
1
1.9k
Other Decks in Programming
See All in Programming
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
830
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
140
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
Zoneless Testing
rainerhahnekamp
0
120
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
4
780
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
960
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
1
270
CloudflareStack でRAGに入門
asahiiwm
0
100
GitHubで育つ コラボレーション文化 : ニフティでのインナーソース挑戦事例 - 2024-12-16 GitHub Universe 2024 Recap in ZOZO
niftycorp
PRO
0
120
テストコード書いてみませんか?
onopon
2
210
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
290
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Featured
See All Featured
How GitHub (no longer) Works
holman
311
140k
We Have a Design System, Now What?
morganepeng
51
7.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Designing Experiences People Love
moore
138
23k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
The Invisible Side of Design
smashingmag
298
50k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
A better future with KSS
kneath
238
17k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Code Review Best Practice
trishagee
65
17k
Scaling GitHub
holman
459
140k
Practical Orchestrator
shlominoach
186
10k
Transcript
SwiftϑϨϯυϦʔObjective-C @nolili Noritaka Kamiya
None
None
None
None
Swift❤ Objective-C❤
try! Swift SwiftϑϨϯυϦʔObjective-C
try! Swift EXC_BAD_INSTRUCTION
try! Swift EXC_BAD_INSTRUCTION Rejected
Swift❤ Objective-C❤
جຊ
Nullability
@interface Memo : NSObject @property (nonatomic) NSDate *createdAt; @property (nonatomic)
NSString *text; @property (nonatomic) NSArray *images; @end Nullability
Nullability open class Memo : NSObject { open var createdAt:
Date! open var text: String! open var images: [Any]! }
@interface Memo : NSObject @property (nonatomic, nonnull) NSDate *createdAt; @property
(nonatomic, nonnull) NSString *text; @property (nonatomic, nonnull) NSArray *images; @end Nullability
open class Memo : NSObject { open var createdAt: Date
open var text: String open var images: [Any] } Nullability
NS_ASSUME_NONNULL_BEGIN @interface Memo : NSObject @property (nonatomic) NSDate *createdAt; @property
(nonatomic) NSString *text; @property (nonatomic) NSArray *images; @end NS_ASSUME_NONNULL_END Nullability
LightWeight Generics
LightWeight Generics NS_ASSUME_NONNULL_BEGIN @interface Memo : NSObject @property (nonatomic) NSDate
*createdAt; @property (nonatomic) NSString *text; @property (nonatomic) NSArray *images; @end NS_ASSUME_NONNULL_END
open class Memo : NSObject { open var createdAt: Date
open var text: String open var images: [Any] } Nullability
LightWeight Generics NS_ASSUME_NONNULL_BEGIN @interface Memo : NSObject @property (nonatomic) NSDate
*createdAt; @property (nonatomic) NSString *text; @property (nonatomic) NSArray<UIImage *> *images; @end NS_ASSUME_NONNULL_END
LightWeight Generics open class Memo : NSObject { open var
createdAt: Date open var text: String open var images: [UIImage] }
ΞϊςʔγϣϯͰSwiftଆؾ࣋ͪΛද໌͢Δ
Blocks / Closure
memo.save { _ in } TrailingClosure typedef void (^SomeCompletionHandler)(NSString *);
@interface Memo : NSObject - (void)save:(SomeCompletionHandler)handler; @end
Closure typedef void (^SomeCompletionHandler)(NSString *); @interface Memo : NSObject -
(void)save:(nullable SomeCompletionHandler)handler; @end memo.save()
noescape typedef void (^SomeCompletionHandler)(NSString *); @interface Notes : NSObject +
(void)save:(__attribute__((noescape)) SomeCompletionHandler)handler; @end memo.save { _ in someSelfMethod() // self. ෆཁ }
Error/Exception
Error + (BOOL)send:(NSError **)error; open class func send() throws
@throw @try @catch @finally
@throw @try @catch @finally X
w $PEJOH(VJEFMJOFTGPS$PDPBʹԊͬͯॻ͘ w (FOFSBUFE*OUFSGBDFΛΈΔ w 4UBUJD"OBMZ[FSΛ׆༻͢Δ w 4XJGU͔ΒJNQPSUͯ͠ΈΔ w ͔͍͍ͬ͜0CKFDUJWF$4XJGU͔ΒΈ͔͍͍ͯͬ͜
৺͕͚͍ͯΔ͜ͱ
None
None
None
None
w $PDPBίʔσΟϯάΨΠυϥΠϯʹԊͬͯॻ͘ w (FOFSBUFE*OUFSGBDFΛΈΔ w 4UBUJD"OBMZ[FSΛ׆༻͢Δ w 4XJGU͔ΒJNQPSUͯ͠ΈΔ w ͔͍͍ͬ͜0CKFDUJWF$4XJGU͔ΒΈ͔͍͍ͯͬ͜
৺͕͚͍ͯΔ͜ͱ
SwiftϑϨϯυϦʔObjective-C @nolili Noritaka Kamiya