Это не stati c или методы класса ... вам нужно создать объект этого класса для вызова его функций сэр ... или сделать их статическими / функциями класса, если вы не хотите создавать объект этого класса
Либо сделайте
func updateUI() {
let story = StoryBrain()
storyLabel.text = story.getStory()
}
Или вы можете использовать их c, но это не очень хороший подход
struct StoryBrain {
static var storyNumber = 0
static let Allstory = [
Story(s: "There is a fork on the road", c1: "Take a left", c2: "Take a right"),
Story(s: "There are two door", c1: "Enter the left door", c2: "Enter the Right door"),
Story(s: "You can have either a dog or a cat", c1: "I will have a dog", c2: "I will have a cat")
]
static func getStory() ->String {
return Allstory[storyNumber].mainStory
}
static func getchoice1() -> String {
return Allstory[storyNumber].choice1
}
static func getchoice2() -> String {
return Allstory[storyNumber].choice2
}
Теперь вы можете сделать
func updateUI() {
storyLabel.text = StoryBrain.getStory()
}