iosdc.jp Ray Fix
ղܾ๏:ఆΛ͏
class Dishɹ{
init(name: String) {
self.name = name
print(" Dish \(name)")
}
deinit {
print("☠ Dish \(name)")
}
}
var name: String
Slide 28
Slide 28 text
iosdc.jp Ray Fix
ղܾ๏:ఆΛ͏
class Dishɹ{
init(name: String) {
self.name = name
print(" Dish \(name)")
}
deinit {
print("☠ Dish \(name)")
}
}
var name: String
Slide 29
Slide 29 text
iosdc.jp Ray Fix
ղܾ๏:ఆΛ͏
class Dishɹ{
init(name: String) {
self.name = name
print(" Dish \(name)")
}
deinit {
print("☠ Dish \(name)")
}
}
let name: String
Slide 30
Slide 30 text
iosdc.jp Ray Fix
ղܾ๏:ఆΛ͏
class Dishɹ{
init(name: String) {
self.name = name
print(" Dish \(name)")
}
deinit {
print("☠ Dish \(name)")
}
}
let name: String
special.name = "ϐʔϚϯ"
Slide 31
Slide 31 text
iosdc.jp Ray Fix
ώʔϓྖҬ
let softCream = Dish(name: “Soft Cream")
let special = softCream
Count: 0
“Soft Cream”
ώʔϓ
ελοΫ
Count: 2
“Soft Cream”
softCream
special
Slide 32
Slide 32 text
iosdc.jp Ray Fix
ώʔϓྖҬ
let softCream = Dish(name: “Soft Cream")
let special = softCream
Count: 0
“Soft Cream”
ώʔϓ
ελοΫ
Slide 33
Slide 33 text
iosdc.jp Ray Fix
ώʔϓྖҬ
let softCream = Dish(name: “Soft Cream")
let special = softCream
ώʔϓ
ελοΫ
Slide 34
Slide 34 text
iosdc.jp Ray Fix
Customer
orders
ɿ॥ࢀর
Order
customer
dish
Dish
name
Slide 35
Slide 35 text
iosdc.jp Ray Fix
ࢀরαΠΫϧ
class Customer {
var orders: [Order]
func add(order: Order) {
order.customer = self
orders.append(order)
}
}
class Order {
var customer: Customer?
let dish: Dish
}
Slide 36
Slide 36 text
iosdc.jp Ray Fix
ࢀরαΠΫϧ
class Customer {
var orders: [Order]
func add(order: Order) {
order.customer = self
orders.append(order)
}
}
class Order {
var customer: Customer?
let dish: Dish
}
Slide 37
Slide 37 text
iosdc.jp Ray Fix
ࢀরαΠΫϧ
let ray = Customer(name: "Ray")
let saikoro = Dish(name: “Saikoro Steak")
let order = Order(dish: saikoro)
ray.add(order: order)
Slide 38
Slide 38 text
iosdc.jp Ray Fix
ࢀরαΠΫϧ
let ray = Customer(name: "Ray")
let saikoro = Dish(name: “Saikoro Steak")
let order = Order(dish: saikoro)
ray.add(order: order)
ray saikoro
order
orders
Slide 39
Slide 39 text
iosdc.jp Ray Fix
ࢀরαΠΫϧ
let ray = Customer(name: "Ray")
let saikoro = Dish(name: “Saikoro Steak")
let order = Order(dish: saikoro)
ray.add(order: order)
ray saikoro
order
orders
Slide 40
Slide 40 text
iosdc.jp Ray Fix
Xcode 8 Memory Visualizer
Slide 41
Slide 41 text
iosdc.jp Ray Fix
Xcode 8 Memory Visualizer
Slide 42
Slide 42 text
iosdc.jp Ray Fix
Xcode 8 Memory Visualizer
Slide 43
Slide 43 text
iosdc.jp Ray Fix
Xcode 8 Memory Visualizer
Slide 44
Slide 44 text
iosdc.jp Ray Fix
Xcode 8 Memory Visualizer
Slide 45
Slide 45 text
iosdc.jp Ray Fix
Customer
orders
॥ࢀর
Order
customer
dish
Dish
name
Slide 46
Slide 46 text
iosdc.jp Ray Fix
॥ࢀর
class Customer {
var orders: [Order]
func add(order: Order) {
order.customer = self
orders.append(order)
}
}
class Order {
let dish: Dish
}
var customer: Customer?
Slide 47
Slide 47 text
iosdc.jp Ray Fix
॥ࢀর
class Customer {
var orders: [Order]
func add(order: Order) {
order.customer = self
orders.append(order)
}
}
class Order {
let dish: Dish
}
var customer: Customer?
weak
Slide 48
Slide 48 text
iosdc.jp Ray Fix
॥ࢀর
class Customer {
var orders: [Order]
func add(order: Order) {
order.customer = self
orders.append(order)
}
}
class Order {
let dish: Dish
}
var customer: Customer?
weak
Slide 49
Slide 49 text
iosdc.jp Ray Fix
॥ࢀর
let ray = Customer(name: "Ray")
let saikoro = Dish(name: "Saikoro")
let order = Order(dish: saikoro)
ray.add(order: order)
ray saikoro
order
orders
Slide 50
Slide 50 text
iosdc.jp Ray Fix
॥ࢀর
let ray = Customer(name: "Ray")
let saikoro = Dish(name: "Saikoro")
let order = Order(dish: saikoro)
ray.add(order: order)
ray saikoro
order
orders
Slide 51
Slide 51 text
iosdc.jp Ray Fix
॥ࢀর
let ray = Customer(name: "Ray")
let saikoro = Dish(name: "Saikoro")
let order = Order(dish: saikoro)
ray.add(order: order)
saikoro
order
nil
Slide 52
Slide 52 text
iosdc.jp Ray Fix
॥ࢀর
let ray = Customer(name: "Ray")
let saikoro = Dish(name: "Saikoro")
let order = Order(dish: saikoro)
ray.add(order: order)
saikoro
Slide 53
Slide 53 text
iosdc.jp Ray Fix
॥ࢀর
let ray = Customer(name: "Ray")
let saikoro = Dish(name: "Saikoro")
let order = Order(dish: saikoro)
ray.add(order: order)
Slide 54
Slide 54 text
iosdc.jp Ray Fix
weak
ࢀর̍
ࢀর̎
ࢀর̏
Slide 55
Slide 55 text
iosdc.jp Ray Fix
weak
ࢀর̍
ࢀর̎
ࢀর̏
Slide 56
Slide 56 text
iosdc.jp Ray Fix
weak
ࢀর̍
ࢀর̎
ࢀর̏
Slide 57
Slide 57 text
iosdc.jp Ray Fix
weak
nil
nil
nil
ࢀর̍
ࢀর̎
ࢀর̏
Slide 58
Slide 58 text
iosdc.jp Ray Fix
weak
nil
nil
nil
ࢀর̍
ࢀর̎
ࢀর̏
reference value
ࢀর̍ nil
ࢀর̎ nil
ࢀর̏ nil
άϩʔόϧςʔϒϧ
Slide 59
Slide 59 text
iosdc.jp Ray Fix
Swift weak
1 3
ࢀর̎
ࢀর̏
ࢀর̍
Slide 60
Slide 60 text
iosdc.jp Ray Fix
Swift weak
1 3
ࢀর̎
ࢀর̏
ࢀর̍
Slide 61
Slide 61 text
iosdc.jp Ray Fix
Swift weak
1 3
0 κϯϏ 3
ࢀর̎
ࢀর̏
ࢀর̍
unowned
class Order {
let dish: Dish
}
class Customer {
var orders: [Order]
func add(dish: Dish) {
let order = Order(dish: dish, customer: self)
orders.append(order)
}
}
let customer: Customer
Slide 68
Slide 68 text
unowned
class Order {
let dish: Dish
}
class Customer {
var orders: [Order]
func add(dish: Dish) {
let order = Order(dish: dish, customer: self)
orders.append(order)
}
}
let customer: Customer
Slide 69
Slide 69 text
unowned
class Order {
let dish: Dish
}
class Customer {
var orders: [Order]
func add(dish: Dish) {
let order = Order(dish: dish, customer: self)
orders.append(order)
}
}
let customer: Customer
unowned
Slide 70
Slide 70 text
unowned
class Order {
let dish: Dish
}
class Customer {
var orders: [Order]
func add(dish: Dish) {
let order = Order(dish: dish, customer: self)
orders.append(order)
}
}
let customer: Customer
unowned