0

I'm new at Swift. In Java I can simply make a new Class if I want to make a new object. For example:

public class Person{
public Person(String firstname, String lastname){
}
}

Then i can simply call the class from another class and initialize a new Person-object and use the getter and setter-methods.

How is that possible in Swift?

1 Answer 1

5

In Swift, this would look like

class Person {
    init(firstname: String, lastname: String) {
        // ...
    }
}

You should read Welcome to Swift and the guides linked there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.