Users Pricing

forum

home / developersection / forums / how to call a function within a structure and a class?

How to call a function within a structure and a class?

Anonymous User 1992 13 Oct 2014
I have two files: ClassA.swift and ClassB.swift
class ClassA: NSObject {
        struct StructA {
            func talk(string: String) {
                println("I say: \(string)")
            }
        }
    }
 
 
    class ClassB: NSObject {
        func makeItTalk(string: String) {
            ClassA.StructA.talk("Hello") <--------------
        }
    }

I get the following error message

Type 'ClassA.StructA' does not conform to protocol 'StringLiteralConvertible'

Any idea why? Is it actually something than can be achieved?


I am a content writter !


2 Answers

Anonymous User 13 Oct 2014 Accepted Answer