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
840
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
130
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
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
イマのCSSでできる インタラクション最前線 + CSS最新情報
clockmaker
4
2.3k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
初めてDefinitelyTypedにPRを出した話
syumai
0
430
Remix on Hono on Cloudflare Workers
yusukebe
1
310
ヤプリ新卒SREの オンボーディング
masaki12
0
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Macとオーディオ再生 2024/11/02
yusukeito
0
380
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
C++でシェーダを書く
fadis
6
4.1k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
RailsConf 2023
tenderlove
29
900
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Visualization
eitanlees
145
15k
Ruby is Unlike a Banana
tanoku
97
11k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
A Tale of Four Properties
chriscoyier
156
23k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
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