Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Newsroom Update

Apple is introducing a new Apple Watch Pride Edition Braided Solo Loop, matching watch face, and dynamic iOS and iPadOS wallpapers as a way to champion global movements to protect and advance equality for LGBTQ+ communities. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to creat customer class in Swift

Hi Guy


I am very new t mobile app dev. I have experience in C++,C# but absolutely 0 in Mobile app. The app I am working on, is ready and working in Desktop C# and now I am going to take it to mobile.


To start with, I am trying to achieve the following but I really dont know how to do it.

For simplicity let's say I have class called Person


class Person{

string Firstname,LastName;

Person(){}

Person(string fName,string lName)

{

FirstName=fName;

LastName=lName;

}

string GetNames()

{

return Firstname+","+LastName

}

}


Now in my Storyoard, let's define two textfileds

@IBOutlet weak var txtLastName : UITextField

@IBOutlet weak var txtFirstName: UITextField

@IBOutlet weak var lblResult: UILabel


All I need to to to create a Person object like:

Person p = new Person(txtLastName.text,txtFirstName.text)

lblResult.text = p.GetNames()

How this is possible?


Thank you

iPhone 6s, iOS 9.1

Posted on Nov 25, 2015 6:50 AM

Reply

There are no replies.

How to creat customer class in Swift

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.