Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
SwiftFriendlyObjective-C/try! Swift Tokyo 2017 RejectCon
Noritaka Kamiya
February 28, 2017
Programming
1
520
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
2.4k
WWDC Pre meeting
nolili
1
2.9k
FastLane with Swift
nolili
0
87
App Transport Securityとローカルネットワーキング/iOSDC Japan 2017
nolili
1
820
iOS Test Night #4
nolili
0
2.9k
iOSアプリ開発のCI/CD環境とユビレジでのtry / CI CDNight
nolili
1
1.5k
ユビレジiOSアプリ開発のCI/CD環境 / iOS Test Night #1
nolili
5
1.9k
Modern Core Data(iOS 10)
nolili
0
1.1k
iOS I/O 2016 アクセサリといっしょ
nolili
1
1.3k
Other Decks in Programming
See All in Programming
WindowsコンテナDojo:第2回 Windowsコンテナアプリのビルド、公開、デプロイ
oniak3ibm
PRO
0
160
Reactでアプリケーションを構築する多様化
sakito
4
3.5k
プログラミングを勉強したいと言われたら
yuba_4
0
430
読みやすいコードを書こう
yutorin
0
440
How useEvent would change our applications
koba04
1
1.8k
NieR Re[in]carnationにおけるUnityアニメーション活用術
applibot
1
940
バンドル最適化マニアクス at tfconf
mizchi
5
2.4k
Let's build components, not layers
thombergs
0
130
CLI構築のススメ
nyankotaro
1
260
iOSアプリの技術選択2022
tattn
6
2.6k
httputil.ReverseProxy でもリトライがしたい
toga4
1
140
競プロへの誘 -いざな-
u76ner
0
380
Featured
See All Featured
The Brand Is Dead. Long Live the Brand.
mthomps
45
2.7k
Debugging Ruby Performance
tmm1
65
10k
Large-scale JavaScript Application Architecture
addyosmani
499
110k
In The Pink: A Labor of Love
frogandcode
130
21k
YesSQL, Process and Tooling at Scale
rocio
157
12k
A designer walks into a library…
pauljervisheath
196
16k
Imperfection Machines: The Place of Print at Facebook
scottboms
253
11k
Unsuck your backbone
ammeep
659
55k
Building Adaptive Systems
keathley
25
1.1k
Testing 201, or: Great Expectations
jmmastey
21
5.4k
Code Review Best Practice
trishagee
41
6.8k
Optimizing for Happiness
mojombo
365
63k
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