0

in objective-c we do

@property (strong, nonatomic) void(^Name)(id input, id selectedListItem);

then we set property

if (self.Name) {
    self.Name(self,nil);
}

for accessing it viewcontroller

[classObject setName:^(id input, id selectedListItem)
// do something with the input and selectedListItem
];

how we can do it in swift3.

1 Answers1

0
@property (strong, nonatomic) void(^Name)(id input, id selectedListItem);

is

var name: ((input: Any, selectedListItem: Any?) -> ())? = nil

Setting is

obj.name = { (input, selectedListItem) in
    // do something with the input and selectedListItem
}

Calling is

if let name = obj.name {
     name(self, nil)
}
Lou Franco
  • 87,846
  • 14
  • 132
  • 192