Questions tagged as 'swift'

1
answer

How to sum variable value with the value of a variable saved in userdefaults

I try to be objective, I need to save a variable that the value that is stored inside will be the text of a label and this value is changed when an input of another variable is performed. For example: Variable balance has the value of 50.0, t...
asked by 11.09.2017 / 22:38
1
answer

How to populate a tableView using for loop and dictionary

I'm making an app that requires multiple tableviews. Some of them have more than 20 cells and some only 4, 5. Then I realized that doing 20 and so many lines of if else is a terrible practice. But since I'm very new to swift, I'd like to know...
asked by 20.06.2017 / 19:49
1
answer

How to calculate distance traveled by me in swift

I am trying to calculate the distance I travel between my starting point, until the moment I stop my race / change of screen. Can you help me? Below are the most relevant parts of the code. @IBOutlet weak var mapa: MKMapView! var gerenciadorLo...
asked by 20.04.2017 / 14:53
1
answer

Difficulty loading sections in cellForRowAt

I'm having a little difficulty in implementing indexes (A through Z) in my app ... See the structure below, what should I do to properly load indexPath.section ?: struct EmployeeDetails { let functionary: String let imageFace: S...
asked by 10.04.2017 / 16:18
2
answers

Swift 3 - How to instantiate a View Controller?

I need to work with a method with attributes that are in another ViewController but I can not do it. What I'm trying: let notasViewController: NotasViewController() And also: let notasViewController: NotasViewController = UIStoryboard.ini...
asked by 24.02.2017 / 15:38
1
answer

How to set maximum size of 2 textfields separately (Swift)

Next, I'm now starting with Swift and iOS programming. I have a question: how to validate 2 different textFields? For example, I managed with the code below to do the validation of 1 single field, but the problem that my application has 4 fields...
asked by 27.03.2017 / 01:30
1
answer

Force execution order Swift 3 / Xcode 8 - Threads

Hello, I'm new to swift and this week I came across a problem that is already making me pull out my hair! What happens is the following, divided in my application in several classes to leave my code more "straightened" and in this wave I decided...
asked by 07.02.2017 / 22:06
1
answer

Swift 3 / Realm - How to filter an Object inside another filter

My intention is to filter a single line within the results of the previous filter, but returning the same type, so that I can perform a third filter. Here's my attempt: func salvarDadosAluno(_codPessoa: String, _codCurso: String){ let...
asked by 21.02.2017 / 20:22
1
answer

IOS - Swift NSString

Good, I'm making an application where I'm going to measure the users BMI. I created the layout but in the code I'm having problems. I have a button that, when sliding, changes the height or weight value. var w:Float = 75 alturachg(_ s...
asked by 13.12.2016 / 11:09
2
answers

swift 3 - how to close a last open popover on another popover?

I have a viewcontroller that opens a popover. This first opens a second popover. However when I give a self.dismiss on any of the popovers it is closing all popovers and the viewcontroller that called it. I use the following commands to call...
asked by 07.11.2016 / 23:29