Users Pricing

forum

Home Forums How to call a function within a structure and a class? – MindStick

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

Anonymous User 2052 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?


2 Answers

Anonymous User 13 Oct 2014 Accepted Answer
Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md