last day (14 days later) » 

8:14 AM
0
A: How to call a function after performing a segue in swift?

Mr.UBViewController1: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "SegueIdentifierHere" { if let destVC = segue.destinationViewController as? ViewController2 { destVC.isButtonClick = true } } } ViewControll...

 
I did everything but still calling questionLevel1 and trowing one question from questionLevel1 and one from my questionLevel2!! I don't know if Im doing something wrong
 
you do not want to call questionLevel1() and pickingRandomQ..() on segue?
 
yes I want to call questionLevel1() on viewDidLoad but just only one time, when the game starts after the user select the next level just call questionLevel2()! you know what Im trying to do?
 
are you re-using same view controller?
 
Im using two view controllers already edited my post with the second view controller
 
8:14 AM
To be more clear,i have few queries:
1. You want to call function in the first view controller after performing segue?
 
ok
sounds good
let me explain here my situation
I want to be able to hit a button in my second view to load my first view (the view where i have my functions and answers with questions) to load the second level of questions(questionsLevel2())
thats what I want to do with my second view
 
so you want to call method from second view to first view?
 
yes :D
well I want to call function wrote on first view when second view is click on the button
thats what I want
 
8:29 AM
ohhhh....alright
can you share your project. will be lot easier
 
how ?
can i share
 
google drive or dropbox or git
anything
 
it will be dropbox
just give me a second
 
ok
 
8:35 AM
yeah...give me few minutes
 
thank you so much
 
your welcome mate
what is the name of your first view controller?
celebrities?
 
CelebritiesViewController
yes
thats one of the 4 that i have
 
ok
 
all my code is a mess hahah
sorry
im new in swift
 
8:58 AM
did you find any solution?
 
10:07 AM
Delegates was the best approach.
 
 
4 hours later…
1:51 PM
Worked?
 

last day (14 days later) »