Instructions icon indicating copy to clipboard operation
Instructions copied to clipboard

Multiple coaches?

Open jegv91 opened this issue 9 years ago • 10 comments

This project looks awesome, but I was looking for something that supports multiple instructions on the screen at the same time. Any plans for this? Thanks in advance!

jegv91 avatar Jan 08 '16 01:01 jegv91

I've thought about it, but it's not implemented yet and I can't give you a reasonable prediction as to when it will roll out. :( (So much on the roadmap and so little time at the moment…)

ephread avatar Jan 09 '16 09:01 ephread

I also think this would be a nice feature. BTW, I managed to make multiple instructions with some work-around as follows:

  1. make flags as properties of ViewController Class, for example,
var firstInstructionFlag = false
var secondInstructionFlag = false
  1. turn them true when it is needed and execute instruction
self.firstInstructionFlag = true
self.coachMarksController.startOn(self)
  1. use these flags in the delegate methods
 func coachMarksController(coachMarksController: CoachMarksController, coachMarksForIndex: Int)
    -> CoachMark {
   var poi = UIView()
   if self.firstInstructionFlag == true {
      poi = theViewYouWannaExplainAboutFirst
   } else if self.secondInstructionFlag == true {
      poi = theViewYouWannaExplainAboutSecond
   }
  return coachMarksController.coachMarkForView(poi)
}

func coachMarksController(coachMarksController: CoachMarksController, coachMarkViewsForIndex: Int, coachMark: CoachMark)
        -> (bodyView: CoachMarkBodyView, arrowView: CoachMarkArrowView?) {
        var coachViews = coachMarksController.defaultCoachViewsWithArrow(true, arrowOrientation: coachMark.arrowOrientation)
       if self.firstInstructionFlag == true {
          //set strings here
          self.firstInstructionFlag = false //reset flag here
        } else if self.secondInstructionFlag == true {
          //set strings here
          self.secondInstructionFlag = false //reset flag here
   }
 return (bodyView: coachViews.bodyView, arrowView: coachViews.arrowView)
}

Hope this helps.

maxykato avatar Feb 21 '16 15:02 maxykato

@maxykato Where are u making the secondInstructionFlag true ?

shivamkedia007 avatar Jun 25 '16 14:06 shivamkedia007

Also I need this too. That would be perfect.

mkaya93 avatar Aug 05 '16 17:08 mkaya93

@shivamkedia007 just wondering if you managed to get @maxykato 's workaround working? I'm not tasked to do this hence it would be great help if I can receive some pointers from you gus

happiehappie avatar Dec 09 '16 03:12 happiehappie

Maybe someone can help clarify: I've got my first coach mark working whenever the app opens. It works perfectly. Now I'd like to add a second coach mark that only triggers when a certain action has occurred (swiped on collection view page), or when the app's been opened a certain amount of time. It is logically decoupled from the first one. Can I make this happen with the current system, or is what "Multiple coach marks support" on the repo refers to? Thanks a bunch, love it dearly.

s2imon avatar May 15 '17 19:05 s2imon

Thanks @s2imon!

Is the second coach mark bound to be displayed at the same time the first one? If yes, that's currently not possible. However if you want to show two different coach marks on two different controllers at two different times, you can simply instantiate CoachMarksController multiple times.

ephread avatar May 18 '17 15:05 ephread

That's great news. I had managed to integrate the first one flawlessly, but since it is detached from the first one in time and space so to speak wasn't sure how to logically approach it. I need to check, but I think that should do it! Thanks Frédéric.

edit: turns out they're actually in the same ViewController. Playing around with it I haven't been able to nail it down yet. Will this 'Note that the CoachMarksController requesting the information is supplied, allowing you to supply data for mutiple CoachMarksController, within a single dataSource.' help? I realise it's a noob question.

s2imon avatar May 18 '17 17:05 s2imon

Ooops, sorry @s2imon, I missed your question.

Note that the CoachMarksController requesting the information is supplied, allowing you to supply data for mutiple CoachMarksController, within a single dataSource.

It simply means that a single object can be the dataSource for two CoachMarkControllers, much like UITableViewDataSource. Unlike what's found in the examples, CoachMarksControllerDataSource could be implemented in an external object, rather than inside the ViewController. This object could stand as the dataSource for different view controllers and you would be able to know which of them is requesting the data, since they are provided in the method call.

ephread avatar Jun 13 '17 14:06 ephread

Thanks a bunch Frédéric! I will try to get that next time I have a bit of time.

s2imon avatar Jun 13 '17 19:06 s2imon

Closing because this enhancement is unlikely to be implemented at this point.

ephread avatar May 03 '23 20:05 ephread