# Swift

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

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

**Page:** 12

---

## [iOS Library for validation data models](https://forums.kodeco.com/t/ios-library-for-validation-data-models/90206)

<div class="topic-metadata">

**Author:** [@redwerk](https://forums.kodeco.com/u/redwerk)\
**Replies:** 1\
**Last updated:** [December 18, 2019, 9:42am UTC](https://forums.kodeco.com/t/ios-library-for-validation-data-models/90206 "2019-12-18T09:42:43Z")

</div>

Hi friends, We are glad to present the new iOS Library for data models validation created by our well-seasoned developer, Volodymyr Sakhan. You can find it on GitHub following the link GitHub - redwerk/ValidateKit: The …

---

## [How to change the size of a uiimageview appended to a empty array](https://forums.kodeco.com/t/how-to-change-the-size-of-a-uiimageview-appended-to-a-empty-array/91516)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 3\
**Last updated:** [December 18, 2019, 9:31am UTC](https://forums.kodeco.com/t/how-to-change-the-size-of-a-uiimageview-appended-to-a-empty-array/91516 "2019-12-18T09:31:21Z")

</div>

My swift code uses a button to place imageviews on a uiviewcontroller that parent from a empty array. The problem is I dont know how to effect the size of the invidicual imageview after it is placed on the uiview control…

---

## [Navigation app advice](https://forums.kodeco.com/t/navigation-app-advice/87948)

<div class="topic-metadata">

**Author:** [@bar24](https://forums.kodeco.com/u/bar24)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 10:30am UTC](https://forums.kodeco.com/t/navigation-app-advice/87948 "2019-12-16T10:30:21Z")

</div>

Hi All A friend of mine has asked me if it is possible to write a navigation/adventure trail app for their property with custom highlights/messages etc at various points in the app…we we all know anything is possible, I…

---

## [Color of CGPoint changes all lines and should only change new lines](https://forums.kodeco.com/t/color-of-cgpoint-changes-all-lines-and-should-only-change-new-lines/86333)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 4\
**Last updated:** [December 16, 2019, 10:25am UTC](https://forums.kodeco.com/t/color-of-cgpoint-changes-all-lines-and-should-only-change-new-lines/86333 "2019-12-16T10:25:56Z")

</div>

My code uses to classes. When the function dizzy is called it changes the color of all the lines in the uiview. What I want it to do is only change lines colors that are drawn after the function is called. It should not …

---

## [How to programatically set a slider that controls a image views width](https://forums.kodeco.com/t/how-to-programatically-set-a-slider-that-controls-a-image-views-width/88399)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 10:24am UTC](https://forums.kodeco.com/t/how-to-programatically-set-a-slider-that-controls-a-image-views-width/88399 "2019-12-16T10:24:30Z")

</div>

My code below is written in all code no storyboard. What I want to do use the slider move to change the width of the imageView pic. What I have tried below does not work. When the slider moves I want the width of pic to …

---

## [Unable to load items from server on CollectionView Scroll end](https://forums.kodeco.com/t/unable-to-load-items-from-server-on-collectionview-scroll-end/89574)

<div class="topic-metadata">

**Author:** [@akashlal](https://forums.kodeco.com/u/akashlal)\
**Replies:** 2\
**Last updated:** [December 16, 2019, 10:20am UTC](https://forums.kodeco.com/t/unable-to-load-items-from-server-on-collectionview-scroll-end/89574 "2019-12-16T10:20:20Z")

</div>

I am trying to make an api call to fetch contents from server, when collection view is about to end scrolling. I plan to override override func collectionView(\_ collectionView: UICollectionView, willDisplay cell: UICol…

---

## [SwiftUI and MacOS](https://forums.kodeco.com/t/swiftui-and-macos/78674)

<div class="topic-metadata">

**Author:** [@rufy](https://forums.kodeco.com/u/rufy)\
**Replies:** 12\
**Last updated:** [December 10, 2019, 10:46am UTC](https://forums.kodeco.com/t/swiftui-and-macos/78674 "2019-12-10T10:46:37Z")

</div>

Hi @raywenderlich and Hi everybody just question: Since SwiftUI greatly facilitates development in the Apple environment is it now possible to have a series of tutorials explaining the development for MacOS? a series o…

---

## [Environment variables are nil \[Vapor\]](https://forums.kodeco.com/t/environment-variables-are-nil-vapor/90823)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 2\
**Last updated:** [December 9, 2019, 12:33pm UTC](https://forums.kodeco.com/t/environment-variables-are-nil-vapor/90823 "2019-12-09T12:33:28Z")

</div>

Environment variables are nil, what am I doing wrong? public func configure( \_ env: inout Environment, \_ config: inout Config, \_ services: inout Services ) throws { // MARK: - Router let router = Eng…

---

## [How to get driving time between two points](https://forums.kodeco.com/t/how-to-get-driving-time-between-two-points/74155)

<div class="topic-metadata">

**Author:** [@akashlal](https://forums.kodeco.com/u/akashlal)\
**Replies:** 2\
**Last updated:** [November 27, 2019, 6:14am UTC](https://forums.kodeco.com/t/how-to-get-driving-time-between-two-points/74155 "2019-11-27T06:14:43Z")

</div>

If I have two latlong, one for source and other for destination, is there any way I can get driving ‘time’ between the two points (accounting for traffic/speed limits)?

---

## [Server Side Swift: Basic HTTP Request](https://forums.kodeco.com/t/server-side-swift-basic-http-request/88929)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 3\
**Last updated:** [November 26, 2019, 2:26am UTC](https://forums.kodeco.com/t/server-side-swift-basic-http-request/88929 "2019-11-26T02:26:01Z")

</div>

Basic HTTP Request - has anyone come across an example? I just want to interact with Google Sheets API . . . associated info - . . . make my changes and spout out json from that json so that it can be used for both iOS…

---

## [How to fetch data from API in SwiftUI views?](https://forums.kodeco.com/t/how-to-fetch-data-from-api-in-swiftui-views/88696)

<div class="topic-metadata">

**Author:** [@martinbean](https://forums.kodeco.com/u/martinbean)\
**Replies:** 4\
**Last updated:** [November 22, 2019, 9:03am UTC](https://forums.kodeco.com/t/how-to-fetch-data-from-api-in-swiftui-views/88696 "2019-11-22T09:03:05Z")

</div>

I’ve done a little iOS development in Swift, and loving SwiftUI, but I’m struggling to understand how and where to fetch data from external web services (APIs) in my SwiftUI views? I have a simple list view that looks l…

---

## [Flip camera while recording video like Instagram](https://forums.kodeco.com/t/flip-camera-while-recording-video-like-instagram/88134)

<div class="topic-metadata">

**Author:** [@hrajput](https://forums.kodeco.com/u/hrajput)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 4:59pm UTC](https://forums.kodeco.com/t/flip-camera-while-recording-video-like-instagram/88134 "2019-11-15T16:59:24Z")

</div>

How can I flip camera while recording video and record continue video like Instagram? I have tried to merge two video but it will miss some part of video and audio.

---

## [Simple problem with .disable](https://forums.kodeco.com/t/simple-problem-with-disable/84711)

<div class="topic-metadata">

**Author:** [@mseriff](https://forums.kodeco.com/u/mseriff)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 10:41am UTC](https://forums.kodeco.com/t/simple-problem-with-disable/84711 "2019-11-15T10:41:48Z")

</div>

I’m fairly new to Swift and SwiftUI but the following code seems pretty straightforward. I’ve stripped it down to a really simple example. I’m trying to use .disabled to enable/disable a button based on the contents of…

---

## [How to save a layered image using a extension function](https://forums.kodeco.com/t/how-to-save-a-layered-image-using-a-extension-function/84884)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 10:12am UTC](https://forums.kodeco.com/t/how-to-save-a-layered-image-using-a-extension-function/84884 "2019-11-15T10:12:35Z")

</div>

I am using a extension function to save a uiview as a uiimage. The code works to save the uiimage. However what I am trying to do is save a transparent image over the image being saved to the photo gallery. So I am tryin…

---

## [How to create a color to erase what you have drawn on a uiview \[duplicate\]](https://forums.kodeco.com/t/how-to-create-a-color-to-erase-what-you-have-drawn-on-a-uiview-duplicate/86089)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 10:04am UTC](https://forums.kodeco.com/t/how-to-create-a-color-to-erase-what-you-have-drawn-on-a-uiview-duplicate/86089 "2019-11-15T10:04:02Z")

</div>

My code below is in 2 seperate classes. From class gooGoo I want to be able to call func change to be used as a eraser to what was drawn on the uiview. If I change drawPlace.drawColor = UIColor.black to drawPlace.drawCol…

---

## [Downcasting of environment object in SwiftUI](https://forums.kodeco.com/t/downcasting-of-environment-object-in-swiftui/85081)

<div class="topic-metadata">

**Author:** [@rrrrobin](https://forums.kodeco.com/u/rrrrobin)\
**Replies:** 3\
**Last updated:** [November 15, 2019, 9:45am UTC](https://forums.kodeco.com/t/downcasting-of-environment-object-in-swiftui/85081 "2019-11-15T09:45:08Z")

</div>

Hi there, I’m storing a heterogenous array of devices \[Device\] in an environment object. Now i want to iterate over it and have a different subview for each different struct (that implements the Device protocol) in the …

---

## [How to set height and width in proportion with superview in SwiftUI?](https://forums.kodeco.com/t/how-to-set-height-and-width-in-proportion-with-superview-in-swiftui/84220)

<div class="topic-metadata">

**Author:** [@vimipatel](https://forums.kodeco.com/u/vimipatel)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 9:37am UTC](https://forums.kodeco.com/t/how-to-set-height-and-width-in-proportion-with-superview-in-swiftui/84220 "2019-11-15T09:37:42Z")

</div>

I want to know that is it possible to adjust height and width in proportion according to superview in SwiftUI to any UIControl ? As we are doing like : let txtFld = UITextField() txtFld.frame = CGRect(origin: CGPoint(x…

---

## [Check core data model for username and password validation](https://forums.kodeco.com/t/check-core-data-model-for-username-and-password-validation/87619)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [November 15, 2019, 4:43am UTC](https://forums.kodeco.com/t/check-core-data-model-for-username-and-password-validation/87619 "2019-11-15T04:43:23Z")

</div>

I want a function to check if a username and password exists in each respective column for validation. Both a username and password have to exists for it to pass. Right now it is implied for both columns to not be nil. t…

---

## [NSTask vs. shell script](https://forums.kodeco.com/t/nstask-vs-shell-script/86257)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 2\
**Last updated:** [November 14, 2019, 10:00pm UTC](https://forums.kodeco.com/t/nstask-vs-shell-script/86257 "2019-11-14T22:00:47Z")

</div>

Upon checking out the NSTask tutorial (https://www.raywenderlich.com/1197-nstask-tutorial-for-os-x) I’m second-guessing myself with regard to the direction I’ve taken with my first MacOS app. Here’s the issue I’m facing…

---

## [Working with stderr and stdout as strings](https://forums.kodeco.com/t/working-with-stderr-and-stdout-as-strings/86519)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 2\
**Last updated:** [November 14, 2019, 9:59pm UTC](https://forums.kodeco.com/t/working-with-stderr-and-stdout-as-strings/86519 "2019-11-14T21:59:34Z")

</div>

I’ve spent an absolutely stupid number of days trying to figure this out, which probably means I’m missing something obvious because surely if someone had ever in the history of the world wondered how to do it, I would h…

---

## [Confused about view controller best practices](https://forums.kodeco.com/t/confused-about-view-controller-best-practices/85381)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 4\
**Last updated:** [November 14, 2019, 9:58pm UTC](https://forums.kodeco.com/t/confused-about-view-controller-best-practices/85381 "2019-11-14T21:58:38Z")

</div>

Before I get too far into my project, I want to clear up what’s the best way to handle things for a sustainable app. While working on the first part of my (MacOS) project, I noticed that my view controller file was gett…

---

## [Does anyone here have any experience writing apps that use FFmpeg?](https://forums.kodeco.com/t/does-anyone-here-have-any-experience-writing-apps-that-use-ffmpeg/85899)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 2\
**Last updated:** [November 14, 2019, 9:50pm UTC](https://forums.kodeco.com/t/does-anyone-here-have-any-experience-writing-apps-that-use-ffmpeg/85899 "2019-11-14T21:50:05Z")

</div>

Hi. I’ve only been coding for a few weeks. I’m trying to write an app that is a very simple front-end for FFmpeg with a very limited scope. Basically, it will be used to convert audiobooks from one format to another, so…

---

## [Unable to spot why a particular method isn't working](https://forums.kodeco.com/t/unable-to-spot-why-a-particular-method-isnt-working/86146)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 2\
**Last updated:** [November 14, 2019, 9:45pm UTC](https://forums.kodeco.com/t/unable-to-spot-why-a-particular-method-isnt-working/86146 "2019-11-14T21:45:07Z")

</div>

I’m unable to spot where I’ve gone wrong in writing the code below, except that it’s probably somewhere in the insertCheckboxArguments method. What this should do is define the ffmpegArguments array based on the convers…

---

## [Updating NSTextField when NSPopupButton selection changes](https://forums.kodeco.com/t/updating-nstextfield-when-nspopupbutton-selection-changes/85030)

<div class="topic-metadata">

**Author:** [@ncrusher](https://forums.kodeco.com/u/ncrusher)\
**Replies:** 2\
**Last updated:** [November 14, 2019, 3:21pm UTC](https://forums.kodeco.com/t/updating-nstextfield-when-nspopupbutton-selection-changes/85030 "2019-11-14T15:21:04Z")

</div>

\*\*\*Edit: The more I look at this, the more I’m convinced that the issue is that the outputText NSTextField is not coded to update when the codecSelector NSPopupButton changes (or the codecSelector popup is not coded to f…

---

## [Presenter can not update its View](https://forums.kodeco.com/t/presenter-can-not-update-its-view/85153)

<div class="topic-metadata">

**Author:** [@appnewsuz](https://forums.kodeco.com/u/appnewsuz)\
**Replies:** 1\
**Last updated:** [November 14, 2019, 3:15pm UTC](https://forums.kodeco.com/t/presenter-can-not-update-its-view/85153 "2019-11-14T15:15:39Z")

</div>

Hi, In my app MVP pattern have been used. And here is like this problem I am experiencing. At first time entering to page all is working fine, presenter is requesting to server and passing datas to view, and view is bei…

---

## [Presently delete core data item in uicollectionviewcell through tag](https://forums.kodeco.com/t/presently-delete-core-data-item-in-uicollectionviewcell-through-tag/84484)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [November 14, 2019, 11:39am UTC](https://forums.kodeco.com/t/presently-delete-core-data-item-in-uicollectionviewcell-through-tag/84484 "2019-11-14T11:39:46Z")

</div>

I am trying to permanently delete a single element from a core data set. Right now the code below removes the core data item but it does not permanently delete it. Once the class is called again it shows up again like no…

---

## [How to delete core data item from a uicollectionviewcell using delegation](https://forums.kodeco.com/t/how-to-delete-core-data-item-from-a-uicollectionviewcell-using-delegation/84198)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [November 14, 2019, 10:31am UTC](https://forums.kodeco.com/t/how-to-delete-core-data-item-from-a-uicollectionviewcell-using-delegation/84198 "2019-11-14T10:31:40Z")

</div>

my code is trying to peremently delete a item from a core data set. This code works with a basic array like \[“sarah”,“Jessica”\]. However when trying to delete var itemName I am getting this error Thread 1: EXC\_BAD\_INSTRU…

---

## [How to grant calendar access to Mac commandline utility](https://forums.kodeco.com/t/how-to-grant-calendar-access-to-mac-commandline-utility/86575)

<div class="topic-metadata">

**Author:** [@tantares](https://forums.kodeco.com/u/tantares)\
**Replies:** 2\
**Last updated:** [November 13, 2019, 1:50pm UTC](https://forums.kodeco.com/t/how-to-grant-calendar-access-to-mac-commandline-utility/86575 "2019-11-13T13:50:42Z")

</div>

Hi, I’m trying to create a commandline utility on Mac Mojave, using Xcode and Swift, which accesses the user Calendar. I’ve already successfully built a Cocoa App, which does the job. However I do not want a GUI as the u…

---

## [Download Materials](https://forums.kodeco.com/t/download-materials/85514)

<div class="topic-metadata">

**Author:** [@mit](https://forums.kodeco.com/u/mit)\
**Replies:** 1\
**Last updated:** [October 28, 2019, 12:44am UTC](https://forums.kodeco.com/t/download-materials/85514 "2019-10-28T00:44:17Z")

</div>

Hello guys, download material isn’t downloading the right material, I’m talking about the new “Programming in Swift: Fundamentals” course, it’s under Begining collections part 2 the instructor is Chris Belanger Do you h…

---

## [UIDocumentPickerViewController 3rd party providers greyed out](https://forums.kodeco.com/t/uidocumentpickerviewcontroller-3rd-party-providers-greyed-out/86209)

<div class="topic-metadata">

**Author:** [@bass](https://forums.kodeco.com/u/bass)\
**Replies:** 1\
**Last updated:** [October 28, 2019, 12:37am UTC](https://forums.kodeco.com/t/uidocumentpickerviewcontroller-3rd-party-providers-greyed-out/86209 "2019-10-28T00:37:33Z")

</div>

I’m following this, in order to pick a folder: https://developer.apple.com/documentation/uikit/view\_controllers/providing\_access\_to\_directories let documentPicker = UIDocumentPickerViewController(documentTypes: \[kUTTyp…

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

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