# Swift

**URL:** https://forums.kodeco.com/c/general/swift/15.md?page=30

[Latest](https://forums.kodeco.com/latest.md) · [Categories](https://forums.kodeco.com/categories.md) · [Tags](https://forums.kodeco.com/tags.md)

**Page:** 31

---

## [Add scrollview over mapview to capture pinch / zoom gestures](https://forums.kodeco.com/t/add-scrollview-over-mapview-to-capture-pinch-zoom-gestures/25008)

<div class="topic-metadata">

**Author:** [@dgaedcke](https://forums.kodeco.com/u/dgaedcke)\
**Replies:** 0\
**Last updated:** [January 10, 2017, 2:58am UTC](https://forums.kodeco.com/t/add-scrollview-over-mapview-to-capture-pinch-zoom-gestures/25008 "2017-01-10T02:58:01Z")

</div>

I’d like my users to use pinch to set the radius of their geofence. I know I can disable user interaction on the mapView like this: mapView.isUserInteractionEnabled = false but that only solves part of the problem. I…

---

## [Howto sort(by: NSManagedObject](https://forums.kodeco.com/t/howto-sort-by-nsmanagedobject/24923)

<div class="topic-metadata">

**Author:** [@erich\_snijder](https://forums.kodeco.com/u/erich_snijder)\
**Replies:** 2\
**Last updated:** [January 8, 2017, 11:21am UTC](https://forums.kodeco.com/t/howto-sort-by-nsmanagedobject/24923 "2017-01-08T11:21:46Z")

</div>

I have an array with multiple NSManagedObject’s. Enery NSManagedObject has an Entity Car. Tha array name is:Cars. Declared like: var cars: \[NSManagedObject\] = \[\] The entity has multiple attributes. One of the attrib…

---

## [Segue is not being transferred](https://forums.kodeco.com/t/segue-is-not-being-transferred/24936)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [January 8, 2017, 12:26am UTC](https://forums.kodeco.com/t/segue-is-not-being-transferred/24936 "2017-01-08T00:26:32Z")

</div>

I am making a game that when a button is pressed twice, it will transfer to another view controller. Right now the users reaction time is timed in view controller a. I would like the time to be segued to view controller …

---

## [Fatal error when unwrapping](https://forums.kodeco.com/t/fatal-error-when-unwrapping/24870)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 3\
**Last updated:** [January 7, 2017, 10:00pm UTC](https://forums.kodeco.com/t/fatal-error-when-unwrapping/24870 "2017-01-07T22:00:01Z")

</div>

This is my code I don’t know what I did wrong. All of the problems are in function steve. import UIKit class restultViewController: UIViewController { @IBOutlet var dxe: UILabel! var LebelText = String() let myInt…

---

## [How to take a timer label and segue it to another view controller](https://forums.kodeco.com/t/how-to-take-a-timer-label-and-segue-it-to-another-view-controller/24819)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 1\
**Last updated:** [January 5, 2017, 10:54pm UTC](https://forums.kodeco.com/t/how-to-take-a-timer-label-and-segue-it-to-another-view-controller/24819 "2017-01-05T22:54:12Z")

</div>

I right now I have a timer. When the user hits a button the timer stops. I would like the label that displays what the timer to be transferred to another view controller. I guess that would mean to segue it. I just don’t…

---

## [How to take a string and convert it into a int in swift 3 for text that is being segued](https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 1\
**Last updated:** [January 5, 2017, 10:51pm UTC](https://forums.kodeco.com/t/how-to-take-a-string-and-convert-it-into-a-int-in-swift-3-for-text-that-is-being-segued/24860 "2017-01-05T22:51:51Z")

</div>

I would like to take lebelText and divide it by 2. Then reconvert the result to a String so it can be displayed in viewdidload. lebelText is being segued. import UIKit class restultViewController: UIViewContr…

---

## [Saving data compared](https://forums.kodeco.com/t/saving-data-compared/24771)

<div class="topic-metadata">

**Author:** [@kathesplace](https://forums.kodeco.com/u/kathesplace)\
**Replies:** 3\
**Last updated:** [January 5, 2017, 10:44pm UTC](https://forums.kodeco.com/t/saving-data-compared/24771 "2017-01-05T22:44:55Z")

</div>

When building apps for the iPhone using Swift/xCode there needs to be a way to save the users data. I believe there are two ways to save this data; using Data Persistence, or using Core Data. What would be the reasons …

---

## [Save CNContact using NSUserDefaults](https://forums.kodeco.com/t/save-cncontact-using-nsuserdefaults/24705)

<div class="topic-metadata">

**Author:** [@gaffney](https://forums.kodeco.com/u/gaffney)\
**Replies:** 2\
**Last updated:** [January 2, 2017, 10:05pm UTC](https://forums.kodeco.com/t/save-cncontact-using-nsuserdefaults/24705 "2017-01-02T22:05:55Z")

</div>

I am trying to save a CNContact using NSUserDefaults. its not saving for some reason I end up getting a SIGABART error. My code is var objects = \[CNContact\]() let myDefaults = NSUserDefaults.standardUserDefaults() let…

---

## [How to put a 2 button condition in a loop in swift 3](https://forums.kodeco.com/t/how-to-put-a-2-button-condition-in-a-loop-in-swift-3/24665)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 30, 2016, 9:06pm UTC](https://forums.kodeco.com/t/how-to-put-a-2-button-condition-in-a-loop-in-swift-3/24665 "2016-12-30T21:06:16Z")

</div>

My code below is a traffic light game. When the light goes green the user has 6 seconds to to hit a button to respond to the green light. If the user does not hit the button within 6 seconds the game goes to the game ove…

---

## [Stacks - Portrait/Landscape & sizing & Newboy here](https://forums.kodeco.com/t/stacks-portrait-landscape-sizing-newboy-here/24653)

<div class="topic-metadata">

**Author:** [@skthornber](https://forums.kodeco.com/u/skthornber)\
**Replies:** 1\
**Last updated:** [December 30, 2016, 9:42am UTC](https://forums.kodeco.com/t/stacks-portrait-landscape-sizing-newboy-here/24653 "2016-12-30T09:42:44Z")

</div>

OK so I have an idea for an App to help me / my Community First Responders. I have been learning swift for only about a month and I have next to no programming experience. The general idea of Class & delegates I think I…

---

## [Populating a tableview with a contact using contacts framework](https://forums.kodeco.com/t/populating-a-tableview-with-a-contact-using-contacts-framework/24615)

<div class="topic-metadata">

**Author:** [@gaffney](https://forums.kodeco.com/u/gaffney)\
**Replies:** 0\
**Last updated:** [December 29, 2016, 11:14am UTC](https://forums.kodeco.com/t/populating-a-tableview-with-a-contact-using-contacts-framework/24615 "2016-12-29T11:14:01Z")

</div>

I want to populate a tableview with contact details that I have entered in the app. first i have a table view controller that will show the list of entered contacts. its swift file looks like this. import Contacts impo…

---

## [How to do a while loop timer](https://forums.kodeco.com/t/how-to-do-a-while-loop-timer/24594)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 29, 2016, 2:53am UTC](https://forums.kodeco.com/t/how-to-do-a-while-loop-timer/24594 "2016-12-29T02:53:39Z")

</div>

My code below is a traffic light that when the light hits green. The user is timed. Right now the user has 3 seconds to hit the button. If the user does not hit the button within 3 seconds the user goes to game over scen…

---

## [Nested if statement in swift function](https://forums.kodeco.com/t/nested-if-statement-in-swift-function/24451)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 2\
**Last updated:** [December 28, 2016, 10:24pm UTC](https://forums.kodeco.com/t/nested-if-statement-in-swift-function/24451 "2016-12-28T22:24:29Z")

</div>

The following function counts down a red to green light, then counts the reaction time for the user to hit a button after the green light is displayed. func updateCounter() { timerInt -= 1 if timerInt == 2{ lig…

---

## [NSCoder: Encoding an enum?](https://forums.kodeco.com/t/nscoder-encoding-an-enum/24452)

<div class="topic-metadata">

**Author:** [@robk331](https://forums.kodeco.com/u/robk331)\
**Replies:** 2\
**Last updated:** [December 27, 2016, 9:00pm UTC](https://forums.kodeco.com/t/nscoder-encoding-an-enum/24452 "2016-12-27T21:00:57Z")

</div>

Hi All, I was wondering if there’s some special magic required to encode an enum… I have a class that has a state which I store in a var called currentState. I’m trying to encode it but when I do I get a “unrecognized …

---

## [How to create a game over restart button in swift](https://forums.kodeco.com/t/how-to-create-a-game-over-restart-button-in-swift/24474)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 25, 2016, 3:05am UTC](https://forums.kodeco.com/t/how-to-create-a-game-over-restart-button-in-swift/24474 "2016-12-25T03:05:08Z")

</div>

http://stackoverflow.com/questions/41318318/how-to-create-a-game-over-restart-button-in-swift?noredirect=1#comment69840374\_41318318

---

## [I would like to add 2 UIImageViews into a single UIImageView. 2 UIImageView nested into a larger UIImageView. Here is a picture of what I am looking for](https://forums.kodeco.com/t/i-would-like-to-add-2-uiimageviews-into-a-single-uiimageview-2-uiimageview-nested-into-a-larger-uiimageview-here-is-a-picture-of-what-i-am-looking-for/24247)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 4\
**Last updated:** [December 22, 2016, 3:34am UTC](https://forums.kodeco.com/t/i-would-like-to-add-2-uiimageviews-into-a-single-uiimageview-2-uiimageview-nested-into-a-larger-uiimageview-here-is-a-picture-of-what-i-am-looking-for/24247 "2016-12-22T03:34:32Z")

</div>

This is the link to my stack overflow question http://stackoverflow.com/questions/41135781/how-to-merge-2-uiimageview-into-another-uiimageview-swift-3

---

## [How to put a picker view inside collectionview cell](https://forums.kodeco.com/t/how-to-put-a-picker-view-inside-collectionview-cell/23910)

<div class="topic-metadata">

**Author:** [@guru](https://forums.kodeco.com/u/guru)\
**Replies:** 3\
**Last updated:** [December 21, 2016, 10:55pm UTC](https://forums.kodeco.com/t/how-to-put-a-picker-view-inside-collectionview-cell/23910 "2016-12-21T22:55:12Z")

</div>

Hi I was going though collectionview tutorial and am struggling to put a UIPickerView inside collectionview cell. Any help.

---

## [Show differents views from annotations](https://forums.kodeco.com/t/show-differents-views-from-annotations/23750)

<div class="topic-metadata">

**Author:** [@fabrice](https://forums.kodeco.com/u/fabrice)\
**Replies:** 7\
**Last updated:** [December 21, 2016, 8:15pm UTC](https://forums.kodeco.com/t/show-differents-views-from-annotations/23750 "2016-12-21T20:15:04Z")

</div>

Hello, I have a card with different pins with a title annotation, subtitle and info button. When I click on the annotations I would like to go on a ViewController associated with the annotation clicked. In advance thank …

---

## [Swift as a first language](https://forums.kodeco.com/t/swift-as-a-first-language/24064)

<div class="topic-metadata">

**Author:** [@timjohnarm](https://forums.kodeco.com/u/timjohnarm)\
**Replies:** 1\
**Last updated:** [December 20, 2016, 3:29am UTC](https://forums.kodeco.com/t/swift-as-a-first-language/24064 "2016-12-20T03:29:06Z")

</div>

Just after peoples thoughts on the suitability of Swift as a first language.

---

## [Uber style app tutorial](https://forums.kodeco.com/t/uber-style-app-tutorial/23905)

<div class="topic-metadata">

**Author:** [@gaffney](https://forums.kodeco.com/u/gaffney)\
**Replies:** 6\
**Last updated:** [December 19, 2016, 4:25am UTC](https://forums.kodeco.com/t/uber-style-app-tutorial/23905 "2016-12-19T04:25:46Z")

</div>

I recently came across a tutorial run by swift owls that shows how to build an uber type app using firebase as its backend. I want to build the a type of app like this and was wondering if anybody knows of another tutori…

---

## [Video tableviews code](https://forums.kodeco.com/t/video-tableviews-code/24167)

<div class="topic-metadata">

**Author:** [@brower](https://forums.kodeco.com/u/brower)\
**Replies:** 1\
**Last updated:** [December 17, 2016, 12:13pm UTC](https://forums.kodeco.com/t/video-tableviews-code/24167 "2016-12-17T12:13:31Z")

</div>

Where can I get the code that is shown in the tableviews video? The video moves to fast. I need to be able to study the code.

---

## [Parsing large XML from server while downloading with LibXML2 in Swift 3](https://forums.kodeco.com/t/parsing-large-xml-from-server-while-downloading-with-libxml2-in-swift-3/24173)

<div class="topic-metadata">

**Author:** [@stefanglaesser](https://forums.kodeco.com/u/stefanglaesser)\
**Replies:** 1\
**Last updated:** [December 16, 2016, 8:32am UTC](https://forums.kodeco.com/t/parsing-large-xml-from-server-while-downloading-with-libxml2-in-swift-3/24173 "2016-12-16T08:32:11Z")

</div>

Hello, I have problems to parse an XML with UTF8-encoding on the fly during download from an URL. I’ve described the problem already on stack, but I did not get an answer on that. Could anybody help me with that? Best…

---

## [How to add a button that overrides a storyboard segue (in swift 3)](https://forums.kodeco.com/t/how-to-add-a-button-that-overrides-a-storyboard-segue-in-swift-3/24015)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 1\
**Last updated:** [December 12, 2016, 3:09am UTC](https://forums.kodeco.com/t/how-to-add-a-button-that-overrides-a-storyboard-segue-in-swift-3/24015 "2016-12-12T03:09:06Z")

</div>

I added a storyboard segue to add text to a photo. Right now you would have to go through 3 view controllers to get the final photo. A(options menu) → B(enter text) → C(take photo). If I add a button to vc b it shows up …

---

## [How to take a saved string and use it another view controller in swift?](https://forums.kodeco.com/t/how-to-take-a-saved-string-and-use-it-another-view-controller-in-swift/23951)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 9, 2016, 11:18pm UTC](https://forums.kodeco.com/t/how-to-take-a-saved-string-and-use-it-another-view-controller-in-swift/23951 "2016-12-09T23:18:26Z")

</div>

The text below here uses a uitextield and saves it to a label. Lets say this is view controller A. I am passing through a to b view controller using a simple button import UIKit class ViewController: UIViewController {…

---

## [Model and Networking Layers](https://forums.kodeco.com/t/model-and-networking-layers/23949)

<div class="topic-metadata">

**Author:** [@bwl1289](https://forums.kodeco.com/u/bwl1289)\
**Replies:** 0\
**Last updated:** [December 9, 2016, 10:16pm UTC](https://forums.kodeco.com/t/model-and-networking-layers/23949 "2016-12-09T22:16:23Z")

</div>

Looking for resources/tutorials to walk through building the model and networking layers of our Swift app step by step. Can anyone point me in the right direction?

---

## [How to take a uitextfeild save the data and have the data be displayed in a photo](https://forums.kodeco.com/t/how-to-take-a-uitextfeild-save-the-data-and-have-the-data-be-displayed-in-a-photo/23902)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 8, 2016, 9:33pm UTC](https://forums.kodeco.com/t/how-to-take-a-uitextfeild-save-the-data-and-have-the-data-be-displayed-in-a-photo/23902 "2016-12-08T21:33:57Z")

</div>

All i would like to do is have the user be able to enter text in uitextfield that is saved and can appear be printed in a picture in a app. So if the user enters abc the picture will be taken with abc on it. I have done …

---

## [Firebase help needed for reading nested data](https://forums.kodeco.com/t/firebase-help-needed-for-reading-nested-data/23803)

<div class="topic-metadata">

**Author:** [@magonicolas](https://forums.kodeco.com/u/magonicolas)\
**Replies:** 0\
**Last updated:** [December 6, 2016, 6:25pm UTC](https://forums.kodeco.com/t/firebase-help-needed-for-reading-nested-data/23803 "2016-12-06T18:25:09Z")

</div>

Hello There! Im making an iOs App with Firebase, and Im having a problem reading my firebase database! I need to read this following structure, can you help me with that? For example the text in 500zNLsK/content/1/parah…

---

## [How to call a extension file for a border of pitcure in swift](https://forums.kodeco.com/t/how-to-call-a-extension-file-for-a-border-of-pitcure-in-swift/23742)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 0\
**Last updated:** [December 5, 2016, 10:51pm UTC](https://forums.kodeco.com/t/how-to-call-a-extension-file-for-a-border-of-pitcure-in-swift/23742 "2016-12-05T22:51:02Z")

</div>

My code below is supposed to feature a customizable border for a photo taken. I originally had a border but it was not customizable. I saw this code online about a customizable border in a extension file (CALAYER). Its o…

---

## [Too many files open](https://forums.kodeco.com/t/too-many-files-open/23589)

<div class="topic-metadata">

**Author:** [@stevepinero](https://forums.kodeco.com/u/stevepinero)\
**Replies:** 2\
**Last updated:** [December 3, 2016, 2:55am UTC](https://forums.kodeco.com/t/too-many-files-open/23589 "2016-12-03T02:55:47Z")

</div>

Hi, i have a problem, while download photos from my server get this error. Error dnssd\_clientstub deliver\_request: socketpair failed 24 (Too many open files) \_\_NSCFLocalDownloadFile: error 24 opening for ioChannel, fil…

---

## [Save Uitableview data in swift 3](https://forums.kodeco.com/t/save-uitableview-data-in-swift-3/23628)

<div class="topic-metadata">

**Author:** [@zalubski](https://forums.kodeco.com/u/zalubski)\
**Replies:** 3\
**Last updated:** [December 3, 2016, 2:17am UTC](https://forums.kodeco.com/t/save-uitableview-data-in-swift-3/23628 "2016-12-03T02:17:55Z")

</div>

This code is a notepad but it cant save its entries. When you switch pages all of the text is erased. I tried to use userdefualts to save my text but I could not figure it out. My button is saveTheTable. Here is picture …

[Previous page](https://forums.kodeco.com/c/general/swift/15.md?page=29)

[Next page](https://forums.kodeco.com/c/general/swift/15.md?page=31)
