SlideShare a Scribd company logo
Just Enough
Objective-C
Daniel Jalkut
Red Sweater Software
Pure Swift
import UIKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let myAlert = UIAlertController(title: "Hello Objective-C",
message: "It's nice to meet you.",
preferredStyle: .alert)
self.present(myAlert, animated: true, completion: nil)
}
}
import UIKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let myAlert = UIAlertController(title: "Hello Objective-C",
message: "It's nice to meet you.",
preferredStyle: .alert)
self.present(myAlert, animated: true, completion: nil)
}
}
Open Your
Ears
Symbol: objc_msgSend
Action: x/s $arg2
150,000+ Calls
objc_msgSend
opensource.apple.com
ENTRY _objc_msgSend
UNWIND _objc_msgSend, NoFrame
cmp p0, #0 // nil check and tagged pointer check
#if SUPPORT_TAGGED_POINTERS
b.leLNilOrTagged // (MSB tagged pointer looks negative)
#else
b.eqLReturnZero
#endif
ldr p13, [x0] // p13 = isa
GetClassFromIsa_p16 p13 // p16 = class
LGetIsaDone:
CacheLookup NORMAL // calls imp or objc_msgSend_uncached
#if SUPPORT_TAGGED_POINTERS
LNilOrTagged:
b.eqLReturnZero // nil check
// tagged
adrpx10, _objc_debug_taggedpointer_classes@PAGE
add x10, x10, _objc_debug_taggedpointer_classes@PAGEOFF
ubfxx11, x0, #60, #4
ldr x16, [x10, x11, LSL #3]
adrpx10, _OBJC_CLASS_$___NSUnrecognizedTaggedPointer@PAGE
add x10, x10, _OBJC_CLASS_$___NSUnrecognizedTaggedPointer@PAGEOFF
cmp x10, x16
b.neLGetIsaDone
// ext tagged
adrpx10, _objc_debug_taggedpointer_ext_classes@PAGE
add x10, x10, _objc_debug_taggedpointer_ext_classes@PAGEOFF
ubfxx11, x0, #52, #8
ldr x16, [x10, x11, LSL #3]
b LGetIsaDone
// SUPPORT_TAGGED_POINTERS
#endif
LReturnZero:
// x0 is already zero
mov x1, #0
movid0, #0
movid1, #0
movid2, #0
movid3, #0
ret
END_ENTRY _objc_msgSend
Method
Selectors
Are Just Strings!
"insertObject:atIndex:"
"insertObject:atIndex:"
[anArray insertObject:anObj atIndex:0];
ojc_msgSend(anArray, “insertObject:atIndex:”,
anObj, 0);
0x7fff51e26db0
anArray.insert("Hi", atIndex:0)
Swift 0x7fff51e26db0
(anArray, ”Hi", 0)
Obj-C
[anArray insertObject:@"Hi" atIndex:0];
objc_msgSend(anArray,“insertObject:atIndex:”,
@“Hi”, 0);
0x7fff51e26db0
(anArray, @”Hi”, 0)
Who Cares?
@objc
Implicitly @objc
Override of ObjC Method
@IBAction Method
ObjC Protocol Conformance
import UIKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let myAlert = UIAlertController(title: "Hello Objective-C",
message: "It's nice to meet you.",
preferredStyle: .alert)
self.present(myAlert, animated: true, completion: nil)
}
}
@objc(theSky:reallyIs:theLimit:here:)
Namespace
Collision Protection
extension UIView {
func fancyMethod() {
// Do something you wish UIView did
}
}
Namespace
Collision Protection
extension UIView {
@objc(redSweater_FancyMethod)
func fancyMethod() {
// Do something you wish UIView did
}
}
Outgoing
Calls
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let myAlert = UIAlertController(title: "Hello Objective-C",
message: "It's nice to meet you.",
preferredStyle: .alert)
self.present(myAlert, animated: true, completion: nil)
}
self.present(myAlert, animated: true, completion: nil)
Calling Private
Methods
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let viewHierarchy = self.view.recursiveDescription
NSLog("My view hierarchy: (viewHierarchy)")
}
Calling Private
Methods
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let viewHierarchy = self.view.perform("recursiveDescription")
NSLog("My view hierarchy: (viewHierarchy)")
}
2019-01-1 17:48:49.573485-0500 Hello Objective-C[53659:310326] My view hierarchy: Optional(Swift.Unmanaged<Swift.AnyObject>(_value: <UIView:
0x7fa836c0dc50; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x600001145ba0>>
| <UIImageView: 0x7fa836c0de30; frame = (0 44; 414 818); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001145bc0>>
| <UIButton: 0x7fa836c014a0; frame = (107.5 594; 199 231); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x600001145720>>
| | <UIButtonLabel: 0x7fa838804310; frame = (0.5 91.5; 198.5 48); text = 'Show Panel'; opaque = NO; userInteractionEnabled = NO; layer =
<_UILabelLayer: 0x60000322fcf0>>))
Bridging
Headers
Import ObjC Interfaces
Available Everywhere
Simplify Call Site Code
Bridging
Headers
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let viewHierarchy = self.view.recursiveDescription
NSLog("My view hierarchy: (viewHierarchy)")
}
//
// Use this file to import your target's public headers that you
// would like to expose to Swift.
//
#import <UIKit/UIKit.h>
#if DEBUG
@interface UIView (RSDebugging)
// Expose private UIView debugging method to Swift
@property (readonly) NSString* recursiveDescription;
@end
#endif
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let viewHierarchy = self.view.recursiveDescription
NSLog("My view hierarchy: (viewHierarchy)")
}
2019-01-1 17:48:49.573485-0500 Hello Objective-C[53659:310326] My view hierarchy: Optional(Swift.Unmanaged<Swift.AnyObject>(_value: <UIView:
0x7fa836c0dc50; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x600001145ba0>>
| <UIImageView: 0x7fa836c0de30; frame = (0 44; 414 818); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001145bc0>>
| <UIButton: 0x7fa836c014a0; frame = (107.5 594; 199 231); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x600001145720>>
| | <UIButtonLabel: 0x7fa838804310; frame = (0.5 91.5; 198.5 48); text = 'Show Panel'; opaque = NO; userInteractionEnabled = NO; layer =
<_UILabelLayer: 0x60000322fcf0>>))
This One
Weird Trick
import UIKit
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let myAlert = UIAlertController(title: "Hello Objective-C",
message: "It's nice to meet you.",
preferredStyle: .alert)
self.present(myAlert, animated: true, completion: nil)
}
}
self.present(myAlert, animated: true, completion: nil)
(lldb) b UIViewController.present(_: __C.UIViewController, animated:
Swift.Bool, completion: Swift.Optional<() -> ()>
self.present(myAlert, animated: true, completion: nil)
Breakpoint 10: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
self.present(myAlert, animated: true, completion: nil)
(lldb) break set -r UIView.*present.*anim.*comp
Breakpoint 1: 8 locations.
(lldb) break list
(lldb) break set -r “-[.*]" // 270K breakpoints!
(lldb) break set -r DebugMode
(lldb) break set -r Emoji
UIKitCore`-[UIViewController presentViewController:animated:completion:]
Pure Swift
Learn More
WWDC 2011 #322
WWDC 2015 #401
Swift Reference: Attributes
WWDC 2011 #322
WWDC 2015 #401
Swift Reference: Attributes
Thank you!

More Related Content

What's hot

Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2
Manfred Steyer
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내
Jung Kim
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page Apps
Morgan Stone
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
Oswald Campesato
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSphilogb
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
Katsumi Kishikawa
 
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
Wanbok Choi
 
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
chicagonewsonlineradio
 
Unbreakable: The Craft of Code
Unbreakable: The Craft of CodeUnbreakable: The Craft of Code
Unbreakable: The Craft of Code
Joe Morgan
 
Prescribing RX Responsibly
Prescribing RX ResponsiblyPrescribing RX Responsibly
Prescribing RX Responsibly
Nareg Khoshafian
 
フレームワークなしでWSGIプログラミング
フレームワークなしでWSGIプログラミングフレームワークなしでWSGIプログラミング
フレームワークなしでWSGIプログラミングAtsushi Odagiri
 
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
Eduardo Lundgren
 
The Ring programming language version 1.8 book - Part 65 of 202
The Ring programming language version 1.8 book - Part 65 of 202The Ring programming language version 1.8 book - Part 65 of 202
The Ring programming language version 1.8 book - Part 65 of 202
Mahmoud Samir Fayed
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
Andrea Prearo
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Jung Kim
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1Bitla Software
 
YUI 3
YUI 3YUI 3
YUI 3
Dav Glass
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12jafar104
 
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android app
Jérémie Laval
 

What's hot (20)

Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2Databinding and Performance-Tuning in Angular 2
Databinding and Performance-Tuning in Angular 2
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page Apps
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
 
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and BeautifulBefore there was Hoop Dreams, there was McDonald's: Strange and Beautiful
Before there was Hoop Dreams, there was McDonald's: Strange and Beautiful
 
Unbreakable: The Craft of Code
Unbreakable: The Craft of CodeUnbreakable: The Craft of Code
Unbreakable: The Craft of Code
 
Prescribing RX Responsibly
Prescribing RX ResponsiblyPrescribing RX Responsibly
Prescribing RX Responsibly
 
フレームワークなしでWSGIプログラミング
フレームワークなしでWSGIプログラミングフレームワークなしでWSGIプログラミング
フレームワークなしでWSGIプログラミング
 
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
YUI3 and AlloyUI Introduction for Pernambuco.JS 2012
 
The Ring programming language version 1.8 book - Part 65 of 202
The Ring programming language version 1.8 book - Part 65 of 202The Ring programming language version 1.8 book - Part 65 of 202
The Ring programming language version 1.8 book - Part 65 of 202
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
 
YUI 3
YUI 3YUI 3
YUI 3
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12
 
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android app
 

Similar to Daniel Jalkut - dotSwift 2019

What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
CocoaHeads France
 
Migrating Objective-C to Swift
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
Elmar Kretzer
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragment
Chiwon Song
 
Tilting at Windmills with ctypes and cygwinreg
Tilting at Windmills with ctypes and cygwinregTilting at Windmills with ctypes and cygwinreg
Tilting at Windmills with ctypes and cygwinreg
Simon Law
 
Android Wear Essentials
Android Wear EssentialsAndroid Wear Essentials
Android Wear Essentials
Nilhcem
 
iOS
iOSiOS
Smooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionViewSmooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionView
Andrea Prearo
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
Ketan Raval
 
Forge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design DataForge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design Data
Autodesk
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Nikolay Rumyantsev
 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
Vitaly Baum
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
NAVER Engineering
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
Nuvole
 
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Mobivery
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
DroidConTLV
 
Ui perfomance
Ui perfomanceUi perfomance
Ui perfomance
Cleveroad
 
Building an End-to-End AngularJS Application
Building an End-to-End AngularJS ApplicationBuilding an End-to-End AngularJS Application
Building an End-to-End AngularJS Application
Dan Wahlin
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With Angular
Ilia Idakiev
 

Similar to Daniel Jalkut - dotSwift 2019 (20)

Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
 
Migrating Objective-C to Swift
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragment
 
Tilting at Windmills with ctypes and cygwinreg
Tilting at Windmills with ctypes and cygwinregTilting at Windmills with ctypes and cygwinreg
Tilting at Windmills with ctypes and cygwinreg
 
Android Wear Essentials
Android Wear EssentialsAndroid Wear Essentials
Android Wear Essentials
 
iOS
iOSiOS
iOS
 
Smooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionViewSmooth scrolling in UITableView and UICollectionView
Smooth scrolling in UITableView and UICollectionView
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 
GCD in Action
GCD in ActionGCD in Action
GCD in Action
 
Forge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design DataForge - DevCon 2016: Visual Reporting with Connected Design Data
Forge - DevCon 2016: Visual Reporting with Connected Design Data
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
 
ASP.NET MVC Internals
ASP.NET MVC InternalsASP.NET MVC Internals
ASP.NET MVC Internals
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
 
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
Ui perfomance
Ui perfomanceUi perfomance
Ui perfomance
 
Building an End-to-End AngularJS Application
Building an End-to-End AngularJS ApplicationBuilding an End-to-End AngularJS Application
Building an End-to-End AngularJS Application
 
Building Reusable Custom Elements With Angular
Building Reusable Custom Elements With AngularBuilding Reusable Custom Elements With Angular
Building Reusable Custom Elements With Angular
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 

Daniel Jalkut - dotSwift 2019

  • 3. import UIKit class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let myAlert = UIAlertController(title: "Hello Objective-C", message: "It's nice to meet you.", preferredStyle: .alert) self.present(myAlert, animated: true, completion: nil) } }
  • 4. import UIKit class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let myAlert = UIAlertController(title: "Hello Objective-C", message: "It's nice to meet you.", preferredStyle: .alert) self.present(myAlert, animated: true, completion: nil) } }
  • 5.
  • 8.
  • 12. ENTRY _objc_msgSend UNWIND _objc_msgSend, NoFrame cmp p0, #0 // nil check and tagged pointer check #if SUPPORT_TAGGED_POINTERS b.leLNilOrTagged // (MSB tagged pointer looks negative) #else b.eqLReturnZero #endif ldr p13, [x0] // p13 = isa GetClassFromIsa_p16 p13 // p16 = class LGetIsaDone: CacheLookup NORMAL // calls imp or objc_msgSend_uncached #if SUPPORT_TAGGED_POINTERS LNilOrTagged: b.eqLReturnZero // nil check // tagged adrpx10, _objc_debug_taggedpointer_classes@PAGE add x10, x10, _objc_debug_taggedpointer_classes@PAGEOFF ubfxx11, x0, #60, #4 ldr x16, [x10, x11, LSL #3] adrpx10, _OBJC_CLASS_$___NSUnrecognizedTaggedPointer@PAGE add x10, x10, _OBJC_CLASS_$___NSUnrecognizedTaggedPointer@PAGEOFF cmp x10, x16 b.neLGetIsaDone // ext tagged adrpx10, _objc_debug_taggedpointer_ext_classes@PAGE add x10, x10, _objc_debug_taggedpointer_ext_classes@PAGEOFF ubfxx11, x0, #52, #8 ldr x16, [x10, x11, LSL #3] b LGetIsaDone // SUPPORT_TAGGED_POINTERS #endif LReturnZero: // x0 is already zero mov x1, #0 movid0, #0 movid1, #0 movid2, #0 movid3, #0 ret END_ENTRY _objc_msgSend
  • 16. 0x7fff51e26db0 anArray.insert("Hi", atIndex:0) Swift 0x7fff51e26db0 (anArray, ”Hi", 0) Obj-C [anArray insertObject:@"Hi" atIndex:0]; objc_msgSend(anArray,“insertObject:atIndex:”, @“Hi”, 0); 0x7fff51e26db0 (anArray, @”Hi”, 0)
  • 18. @objc
  • 19. Implicitly @objc Override of ObjC Method @IBAction Method ObjC Protocol Conformance
  • 20. import UIKit class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let myAlert = UIAlertController(title: "Hello Objective-C", message: "It's nice to meet you.", preferredStyle: .alert) self.present(myAlert, animated: true, completion: nil) } }
  • 21.
  • 23. Namespace Collision Protection extension UIView { func fancyMethod() { // Do something you wish UIView did } }
  • 24. Namespace Collision Protection extension UIView { @objc(redSweater_FancyMethod) func fancyMethod() { // Do something you wish UIView did } }
  • 26. override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let myAlert = UIAlertController(title: "Hello Objective-C", message: "It's nice to meet you.", preferredStyle: .alert) self.present(myAlert, animated: true, completion: nil) }
  • 27.
  • 29. Calling Private Methods override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let viewHierarchy = self.view.recursiveDescription NSLog("My view hierarchy: (viewHierarchy)") }
  • 30. Calling Private Methods override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let viewHierarchy = self.view.perform("recursiveDescription") NSLog("My view hierarchy: (viewHierarchy)") } 2019-01-1 17:48:49.573485-0500 Hello Objective-C[53659:310326] My view hierarchy: Optional(Swift.Unmanaged<Swift.AnyObject>(_value: <UIView: 0x7fa836c0dc50; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x600001145ba0>> | <UIImageView: 0x7fa836c0de30; frame = (0 44; 414 818); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001145bc0>> | <UIButton: 0x7fa836c014a0; frame = (107.5 594; 199 231); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x600001145720>> | | <UIButtonLabel: 0x7fa838804310; frame = (0.5 91.5; 198.5 48); text = 'Show Panel'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000322fcf0>>))
  • 31. Bridging Headers Import ObjC Interfaces Available Everywhere Simplify Call Site Code
  • 32. Bridging Headers override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let viewHierarchy = self.view.recursiveDescription NSLog("My view hierarchy: (viewHierarchy)") }
  • 33. // // Use this file to import your target's public headers that you // would like to expose to Swift. // #import <UIKit/UIKit.h> #if DEBUG @interface UIView (RSDebugging) // Expose private UIView debugging method to Swift @property (readonly) NSString* recursiveDescription; @end #endif
  • 34. override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let viewHierarchy = self.view.recursiveDescription NSLog("My view hierarchy: (viewHierarchy)") } 2019-01-1 17:48:49.573485-0500 Hello Objective-C[53659:310326] My view hierarchy: Optional(Swift.Unmanaged<Swift.AnyObject>(_value: <UIView: 0x7fa836c0dc50; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x600001145ba0>> | <UIImageView: 0x7fa836c0de30; frame = (0 44; 414 818); autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001145bc0>> | <UIButton: 0x7fa836c014a0; frame = (107.5 594; 199 231); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x600001145720>> | | <UIButtonLabel: 0x7fa838804310; frame = (0.5 91.5; 198.5 48); text = 'Show Panel'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000322fcf0>>))
  • 36. import UIKit class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let myAlert = UIAlertController(title: "Hello Objective-C", message: "It's nice to meet you.", preferredStyle: .alert) self.present(myAlert, animated: true, completion: nil) } } self.present(myAlert, animated: true, completion: nil)
  • 37. (lldb) b UIViewController.present(_: __C.UIViewController, animated: Swift.Bool, completion: Swift.Optional<() -> ()> self.present(myAlert, animated: true, completion: nil) Breakpoint 10: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations.
  • 38. self.present(myAlert, animated: true, completion: nil) (lldb) break set -r UIView.*present.*anim.*comp Breakpoint 1: 8 locations. (lldb) break list (lldb) break set -r “-[.*]" // 270K breakpoints! (lldb) break set -r DebugMode (lldb) break set -r Emoji UIKitCore`-[UIViewController presentViewController:animated:completion:]
  • 40. Learn More WWDC 2011 #322 WWDC 2015 #401 Swift Reference: Attributes
  • 41. WWDC 2011 #322 WWDC 2015 #401 Swift Reference: Attributes Thank you!