toString and function issue

class Addresses {
    var streetname: String
    var streetnumber : Int
    var suburb: String
    var postcode:Int
    
    init( streetname:String, streetnumber:Int, suburb:String, postcode:Int ) {
        self.streetname = streetname
        self.streetnumber = streetnumber
        self.suburb = suburb
        self.postcode = postcode
    }
    func toString( streetname:String, streetnumber:Int, suburb:String, postcode:Int ) -> (String) {
        return (streetnumber),streetname, suburb, postcode
    }
}

I'm trying to create class named Address which stores the postcode, suburb, street name and street number of a building. An initialiser as well as a toString method which returns a String of a human-readable version of the class. This error message keeps popping up Cannot convert return expression of type 'Int' to return type 'String'



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation