w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
calling a global function from a local function with the same name in swift

Well, if you can help it, don't do the first thing. If you must, make your global functions static methods of a struct and you'll be able to reach them that way:

struct Logger {
    static func look(){
        //log stuff
    }
}

class MyClass {
    func look(){
        Logger.look()
    }
}

That is crazy that String in Swift isn't Printable. If you want to add it yourself, this will do it:

extension String: Printable {
    public var description: String { return self }
}

In the mean time, time to file a radar!





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.