0

I found here that performSelector: withObject: is not available in swift, Can someone help I am trying to convert app written in Obj C to Swift, any of founded answers didn't help. This is the code

[newTopViewController performSelector:@selector(setSalesDocumentType:)withObject:@(menuItem.salesDocumentType)];

Tried every answer here Alternative to performSelector in Swift? , nothing helps. NSTimer doesn't have property withObject:, main thread doesn't help too.

Community
  • 1
  • 1
Atan
  • 168
  • 2
  • 4

3 Answers3

0

You don't need to don more Thing just do this :-

DataShowViewController.performSelectorOnMainThread("selector:", withObject: AnyObject?(), waitUntilDone: false, modes: nil)

In AnyObject You Can Pass Your Object.......

0

Try this


var timer = NSTimer.ScheduledTimerWithTimerInterval(1.0,target:self selector:Selector("functionName") userInfo: nil, repeats: false)
Ram Vadranam
  • 485
  • 5
  • 14
0

Please Try This

DataShowViewController.performSelector("YourSelector:", onThread: hereIsYOurThred, withObject: HereIsYOurObj, waitUntilDone: true, modes: yourModes)