# Swift

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

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

**Page:** 9

---

## [Guidance required on View Hierarchy and Delegation](https://forums.kodeco.com/t/guidance-required-on-view-hierarchy-and-delegation/108093)

<div class="topic-metadata">

**Author:** [@ste23](https://forums.kodeco.com/u/ste23)\
**Replies:** 1\
**Last updated:** [July 6, 2020, 2:26am UTC](https://forums.kodeco.com/t/guidance-required-on-view-hierarchy-and-delegation/108093 "2020-07-06T02:26:17Z")

</div>

Hi. I’m currently working on my largest app to date. I’ve been guilty of using Massive View Controllers in the past and I’m working hard to keep everything re-usable where possible and to not repeat my code. In this exam…

---

## [Asynchronous unit testing of unreliable 3rd party API](https://forums.kodeco.com/t/asynchronous-unit-testing-of-unreliable-3rd-party-api/114011)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 1\
**Last updated:** [July 5, 2020, 7:21am UTC](https://forums.kodeco.com/t/asynchronous-unit-testing-of-unreliable-3rd-party-api/114011 "2020-07-05T07:21:30Z")

</div>

@jessycatterwaul hate to tag you again but having gone through the set of unit testing videos, I am unsure if the below has a big glaring apparent blunder func testFetchRoutingFile() { // given let routingFile =…

---

## [SwiftUI: Why UIHostingController(rootView:) can pass nil value?](https://forums.kodeco.com/t/swiftui-why-uihostingcontroller-rootview-can-pass-nil-value/113995)

<div class="topic-metadata">

**Author:** [@hopy](https://forums.kodeco.com/u/hopy)\
**Replies:** 2\
**Last updated:** [July 5, 2020, 6:48am UTC](https://forums.kodeco.com/t/swiftui-why-uihostingcontroller-rootview-can-pass-nil-value/113995 "2020-07-05T06:48:56Z")

</div>

In Xcode playground : func makeView\<T:View\>(v: T) -\> T?{ nil } let v0 = makeView(v: Text("")) let view = UIHostingController(rootView: v0) note that func UIHostingController(rootView: ) signature not allowed pass…

---

## [Apply gif to SCNPlane](https://forums.kodeco.com/t/apply-gif-to-scnplane/105820)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [July 5, 2020, 3:13am UTC](https://forums.kodeco.com/t/apply-gif-to-scnplane/105820 "2020-07-05T03:13:20Z")

</div>

Right now my swift code creates a scnplane with a image called we.jpg. What I would like to is replace we.jpg with a gif call ball.gif. materail.diffuse.conents is where the uiimage is attached to the scnplane. let plan…

---

## [Global Variable Issue](https://forums.kodeco.com/t/global-variable-issue/113059)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 2\
**Last updated:** [July 5, 2020, 3:02am UTC](https://forums.kodeco.com/t/global-variable-issue/113059 "2020-07-05T03:02:27Z")

</div>

I am stuck trying to pass a variable from one view page to another. I am trying to pass the max value in an array to put in the region calculation on a model view. I want to assign allDistances.max() to annotationMaxDis…

---

## [Custom view in SwiftUI reuse it in another view but need to have that view change properties of custom view like a button text color](https://forums.kodeco.com/t/custom-view-in-swiftui-reuse-it-in-another-view-but-need-to-have-that-view-change-properties-of-custom-view-like-a-button-text-color/107209)

<div class="topic-metadata">

**Author:** [@directx](https://forums.kodeco.com/u/directx)\
**Replies:** 1\
**Last updated:** [July 5, 2020, 1:58am UTC](https://forums.kodeco.com/t/custom-view-in-swiftui-reuse-it-in-another-view-but-need-to-have-that-view-change-properties-of-custom-view-like-a-button-text-color/107209 "2020-07-05T01:58:05Z")

</div>

I created a custom login view. I use that view within another view. I want the view using it to be able to set something like a color on a button. I tried doing this with passing color in the init and I was able to ge…

---

## [Problems using CoreData with List and detail views -- weird animations](https://forums.kodeco.com/t/problems-using-coredata-with-list-and-detail-views-weird-animations/104986)

<div class="topic-metadata">

**Author:** [@srinivasgs](https://forums.kodeco.com/u/srinivasgs)\
**Replies:** 1\
**Last updated:** [July 4, 2020, 3:16am UTC](https://forums.kodeco.com/t/problems-using-coredata-with-list-and-detail-views-weird-animations/104986 "2020-07-04T03:16:56Z")

</div>

I want to have simple app that has a sorted list of items. Clicking on each item goes into a detail view, where clicking another button updates a field of an item, which should redraw the original list. The list view is…

---

## [SwiftUI NavigationLink and View Model Issues](https://forums.kodeco.com/t/swiftui-navigationlink-and-view-model-issues/104173)

<div class="topic-metadata">

**Author:** [@cgray9](https://forums.kodeco.com/u/cgray9)\
**Replies:** 1\
**Last updated:** [July 4, 2020, 1:45am UTC](https://forums.kodeco.com/t/swiftui-navigationlink-and-view-model-issues/104173 "2020-07-04T01:45:19Z")

</div>

Context I’m porting functionality of my app to SwiftUI and ran into an issue with navigation. When an NavigationLink is selected from the List it loads the Details view and onAppear fetches data that then updates the Det…

---

## [presentationMode dismiss issue](https://forums.kodeco.com/t/presentationmode-dismiss-issue/94598)

<div class="topic-metadata">

**Author:** [@roguescroll](https://forums.kodeco.com/u/roguescroll)\
**Replies:** 2\
**Last updated:** [May 2, 2020, 5:41am UTC](https://forums.kodeco.com/t/presentationmode-dismiss-issue/94598 "2020-05-02T05:41:18Z")

</div>

Hi, I am working through the iOS developer path and I am on the “your second iOS and SwiftUI app” course. In the “Adding and deleting tasks”, we dismiss the modal using self.presentationMode.wrappedValue.dismiss() H…

---

## [Discord Server For Apple Development](https://forums.kodeco.com/t/discord-server-for-apple-development/101251)

<div class="topic-metadata">

**Author:** [@nachamuni](https://forums.kodeco.com/u/nachamuni)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 11:02pm UTC](https://forums.kodeco.com/t/discord-server-for-apple-development/101251 "2020-07-02T23:02:41Z")

</div>

Hi @ All, I was wondering if there is a Discord Server for Apple Development?

---

## [Exc\_bad\_instruction](https://forums.kodeco.com/t/exc-bad-instruction/113498)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 2\
**Last updated:** [June 30, 2020, 5:07pm UTC](https://forums.kodeco.com/t/exc-bad-instruction/113498 "2020-06-30T17:07:20Z")

</div>

Any suggestion where I could start looking? Everything was working fine until I made a couple view changes which i have since returned to original but I get this error:

---

## [Newbie Help Please!](https://forums.kodeco.com/t/newbie-help-please/113348)

<div class="topic-metadata">

**Author:** [@pilotsoft](https://forums.kodeco.com/u/pilotsoft)\
**Replies:** 4\
**Last updated:** [June 29, 2020, 5:43am UTC](https://forums.kodeco.com/t/newbie-help-please/113348 "2020-06-29T05:43:29Z")

</div>

I seem to be going round in circles with Core Data in Xcode/SwiftUI. I have entered the code (and have got running) Both “Chapter 1: Your first Core Data App” through to “Chapter 3: The Core Data Stack”. I am beginning t…

---

## [Resources for Safari Extension Apps / Safari Extensions](https://forums.kodeco.com/t/resources-for-safari-extension-apps-safari-extensions/113374)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 1\
**Last updated:** [June 28, 2020, 4:15pm UTC](https://forums.kodeco.com/t/resources-for-safari-extension-apps-safari-extensions/113374 "2020-06-28T16:15:16Z")

</div>

anyone know of good resources for creating Safari Extension Apps (do not have an existing app)? have not come across a whole lot (Search - Apple Developer) . . . at a point where I am thinking of creating a chrome extens…

---

## [Removing duplicates whilst preserving order](https://forums.kodeco.com/t/removing-duplicates-whilst-preserving-order/113146)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 4\
**Last updated:** [June 28, 2020, 7:18am UTC](https://forums.kodeco.com/t/removing-duplicates-whilst-preserving-order/113146 "2020-06-28T07:18:06Z")

</div>

Removing duplicates whilst preserving order @jcatterwaul / @jessycatterwaul (Removing duplicate elements from an array in Swift - Stack Overflow) "If you put both extensions in your code, the faster Hashable version wi…

---

## [Tableview not fetching core data date](https://forums.kodeco.com/t/tableview-not-fetching-core-data-date/113118)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 2\
**Last updated:** [June 27, 2020, 4:43pm UTC](https://forums.kodeco.com/t/tableview-not-fetching-core-data-date/113118 "2020-06-27T16:43:55Z")

</div>

My code when button btn is touched it should save the date and then display it on the tableview cell. Nothing is happening when the button is called. The code work in storyboard but it did not work when I programmed it. …

---

## [Label with Ruby Annotation](https://forums.kodeco.com/t/label-with-ruby-annotation/99327)

<div class="topic-metadata">

**Author:** [@rufy](https://forums.kodeco.com/u/rufy)\
**Replies:** 14\
**Last updated:** [June 27, 2020, 3:56pm UTC](https://forums.kodeco.com/t/label-with-ruby-annotation/99327 "2020-06-27T15:56:27Z")

</div>

Hi everybody, for my app I need a label that can shows a text with ruby annotation. I’ve found this site. unfortunately an other Apple update makes this code useless, because ViewController calculates the cell size ba…

---

## [Initializer unused](https://forums.kodeco.com/t/initializer-unused/113163)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 2\
**Last updated:** [June 25, 2020, 3:37pm UTC](https://forums.kodeco.com/t/initializer-unused/113163 "2020-06-25T15:37:27Z")

</div>

Any help on this? Result of ‘ForEach\<Data, ID, Content\>’ initializer is unused func descriptionItem(myFrom: Int, myTo: Int) { ForEach(myFrom …\< myTo) { item in Button(action: { self.myDetail = self.mySites\[item\] se…

---

## [Collapsable and Expandable collection views](https://forums.kodeco.com/t/collapsable-and-expandable-collection-views/112392)

<div class="topic-metadata">

**Author:** [@bahaahany](https://forums.kodeco.com/u/bahaahany)\
**Replies:** 1\
**Last updated:** [June 23, 2020, 4:40pm UTC](https://forums.kodeco.com/t/collapsable-and-expandable-collection-views/112392 "2020-06-23T16:40:46Z")

</div>

Hi experts, I need your help on creating a collapsable and expandable collection views I followed Beginning Collection Views course and created the collection views successfully. I want to make all the sections collap…

---

## [Swiftui function Calls](https://forums.kodeco.com/t/swiftui-function-calls/111507)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 1\
**Last updated:** [June 11, 2020, 7:11am UTC](https://forums.kodeco.com/t/swiftui-function-calls/111507 "2020-06-11T07:11:55Z")

</div>

Hello, I can’t seem to call this function anywhere in my code. I get this error: Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type when I place it li…

---

## [Return a 2D Array from a Func](https://forums.kodeco.com/t/return-a-2d-array-from-a-func/111336)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 1\
**Last updated:** [June 11, 2020, 11:46pm UTC](https://forums.kodeco.com/t/return-a-2d-array-from-a-func/111336 "2020-06-11T23:46:32Z")

</div>

Can anyone let me know what i can do here to return a 2D array? From this below i get: Consecutive declarations on a line must be separated by ‘;’ Thank you func findLocationsForEachRange() -\> \[\[Double\]\] { //var myCount…

---

## [Where to start with MacOS and Swift?](https://forums.kodeco.com/t/where-to-start-with-macos-and-swift/111254)

<div class="topic-metadata">

**Author:** [@smickie](https://forums.kodeco.com/u/smickie)\
**Replies:** 6\
**Last updated:** [June 15, 2020, 9:41am UTC](https://forums.kodeco.com/t/where-to-start-with-macos-and-swift/111254 "2020-06-15T09:41:13Z")

</div>

Hi, I want to start developing MacOS apps in Swift (as a side project). I’ve never touched Mac or iOS development before. I have 10 years of Ruby and Javascript experience, so deff a senior software engineer. I was wond…

---

## [Accessing cell content outside the cellForRowAt function](https://forums.kodeco.com/t/accessing-cell-content-outside-the-cellforrowat-function/99648)

<div class="topic-metadata">

**Author:** [@vkvkcy](https://forums.kodeco.com/u/vkvkcy)\
**Replies:** 6\
**Last updated:** [June 14, 2020, 3:01am UTC](https://forums.kodeco.com/t/accessing-cell-content-outside-the-cellforrowat-function/99648 "2020-06-14T03:01:38Z")

</div>

I am trying to change the background color of certain UILabels based on the value of one of the labels. I have set up a custom function to effect this change. My problem is I have been unsuccessful in trying to access t…

---

## [\[VAPOR\] FluentMySQL: Unable to create a table \[RESOLVED\]](https://forums.kodeco.com/t/vapor-fluentmysql-unable-to-create-a-table-resolved/89455)

<div class="topic-metadata">

**Author:** [@lganti](https://forums.kodeco.com/u/lganti)\
**Replies:** 3\
**Last updated:** [June 12, 2020, 12:48am UTC](https://forums.kodeco.com/t/vapor-fluentmysql-unable-to-create-a-table-resolved/89455 "2020-06-12T00:48:54Z")

</div>

why this on only SheetData model? Conform SheetData to ReflectionDecodable: extension SheetData: ReflectionDecodable { }. models: https://gist.github.com/lahariganti/2cc0afe477017fe0293eac8676e7e78c configure: https://…

---

## [Can't set Swift Combine Future Output Type to Void](https://forums.kodeco.com/t/cant-set-swift-combine-future-output-type-to-void/103657)

<div class="topic-metadata">

**Author:** [@giguerea](https://forums.kodeco.com/u/giguerea)\
**Replies:** 2\
**Last updated:** [June 12, 2020, 12:40am UTC](https://forums.kodeco.com/t/cant-set-swift-combine-future-output-type-to-void/103657 "2020-06-12T00:40:39Z")

</div>

In Swift Combine Future Publisher, I can’t set the output type value to Void return Future\<Void, Error\> { (promise) in promise(.success()) \<— This line is in error } Missing argument for parameter #1 in call thanks …

---

## [SwfitUI Scroll View Bounce property](https://forums.kodeco.com/t/swfitui-scroll-view-bounce-property/101669)

<div class="topic-metadata">

**Author:** [@iostok69](https://forums.kodeco.com/u/iostok69)\
**Replies:** 2\
**Last updated:** [June 12, 2020, 12:38am UTC](https://forums.kodeco.com/t/swfitui-scroll-view-bounce-property/101669 "2020-06-12T00:38:59Z")

</div>

Hello everyone, I am now creating SwiftUI to create a ScrollView. I am wondering how can I disable the user to scroll above the screen height? Right now I am using SwiftUI and I have a content view embedded in a scroll…

---

## [Icloud - read contents of url](https://forums.kodeco.com/t/icloud-read-contents-of-url/110570)

<div class="topic-metadata">

**Author:** [@dbozeman](https://forums.kodeco.com/u/dbozeman)\
**Replies:** 3\
**Last updated:** [June 12, 2020, 12:10am UTC](https://forums.kodeco.com/t/icloud-read-contents-of-url/110570 "2020-06-12T00:10:54Z")

</div>

Is it possible to read contents of an url from a file on iCloud Drive? When I try to read it returns a string that has been converted to binary? or when I do it base64string it converts it to something different also. I …

---

## [Function declares an opague return](https://forums.kodeco.com/t/function-declares-an-opague-return/111321)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 1\
**Last updated:** [June 12, 2020, 12:02am UTC](https://forums.kodeco.com/t/function-declares-an-opague-return/111321 "2020-06-12T00:02:47Z")

</div>

Any help would be appreciated, thank you

---

## [Directory Enumeration & Finding Files by Filename](https://forums.kodeco.com/t/directory-enumeration-finding-files-by-filename/106204)

<div class="topic-metadata">

**Author:** [@ndhotsky](https://forums.kodeco.com/u/ndhotsky)\
**Replies:** 6\
**Last updated:** [June 11, 2020, 11:49pm UTC](https://forums.kodeco.com/t/directory-enumeration-finding-files-by-filename/106204 "2020-06-11T23:49:56Z")

</div>

Coming from the FileManager Class Tutorial (FileManager Class Tutorial for macOS: Getting Started with the File System | Ray Wenderlich), I’ve been trying to produce a function that searches a user-chosen directory for f…

---

## [Error Conflicting types for 'GDTCORLog' in Xcode](https://forums.kodeco.com/t/error-conflicting-types-for-gdtcorlog-in-xcode/107352)

<div class="topic-metadata">

**Author:** [@roaasaud](https://forums.kodeco.com/u/roaasaud)\
**Replies:** 2\
**Last updated:** [May 2, 2020, 4:29am UTC](https://forums.kodeco.com/t/error-conflicting-types-for-gdtcorlog-in-xcode/107352 "2020-05-02T04:29:16Z")

</div>

hi everybody… I want to help me for this problem in my project in Xcode version 11

---

## [Use ML Kit Firebase with SwiftUI](https://forums.kodeco.com/t/use-ml-kit-firebase-with-swiftui/98575)

<div class="topic-metadata">

**Author:** [@eszter](https://forums.kodeco.com/u/eszter)\
**Replies:** 2\
**Last updated:** [April 1, 2020, 5:35am UTC](https://forums.kodeco.com/t/use-ml-kit-firebase-with-swiftui/98575 "2020-04-01T05:35:11Z")

</div>

I had a look at ML Kit with Firebase recently and found this Tutorial: https://www.raywenderlich.com/6565-ml-kit-tutorial-for-ios-recognizing-text-in-images I wonder if anyone tried to replicate it with SwiftUI or if t…

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

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