$30 off During Our Annual Pro Sale. View Details »
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
970
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.5k
WWDC Pre meeting
nolili
1
3.5k
FastLane with Swift
nolili
0
170
App Transport Securityとローカルネットワーキング/iOSDC Japan 2017
nolili
1
1.6k
iOS Test Night #4
nolili
0
4k
iOSアプリ開発のCI/CD環境とユビレジでのtry / CI CDNight
nolili
1
1.8k
ユビレジiOSアプリ開発のCI/CD環境 / iOS Test Night #1
nolili
5
2.4k
Modern Core Data(iOS 10)
nolili
0
1.4k
iOS I/O 2016 アクセサリといっしょ
nolili
1
2.1k
Other Decks in Programming
See All in Programming
sbt 2
xuwei_k
0
290
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
150
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
380
20 years of Symfony, what's next?
fabpot
2
350
SwiftUIで本格音ゲー実装してみた
hypebeans
0
350
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
320
Developing static sites with Ruby
okuramasafumi
0
280
認証・認可の基本を学ぼう後編
kouyuume
0
190
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
220
JETLS.jl ─ A New Language Server for Julia
abap34
1
400
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.4k
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
6
1.3k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
7.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Music & Morning Musume
bryan
46
7k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Faster Mobile Websites
deanohume
310
31k
Making Projects Easy
brettharned
120
6.5k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
RailsConf 2023
tenderlove
30
1.3k
Scaling GitHub
holman
464
140k
Building an army of robots
kneath
306
46k
Thoughts on Productivity
jonyablonski
73
5k
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