# Swift

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

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

**Page:** 6

---

## [Creating individual list of favorites from a larger set of MapKit annotations](https://forums.kodeco.com/t/creating-individual-list-of-favorites-from-a-larger-set-of-mapkit-annotations/133929)

<div class="topic-metadata">

**Author:** [@frostbite](https://forums.kodeco.com/u/frostbite)\
**Replies:** 2\
**Last updated:** [April 1, 2021, 7:58pm UTC](https://forums.kodeco.com/t/creating-individual-list-of-favorites-from-a-larger-set-of-mapkit-annotations/133929 "2021-04-01T19:58:41Z")

</div>

(Trigger alert: Post does not contain any code). Beginner programmer here. I am working on an app in Swift, it is going fine, considering my lack of experience and knowledge. But there is one feature I can’t figure out…

---

## [Access to struct properties](https://forums.kodeco.com/t/access-to-struct-properties/136192)

<div class="topic-metadata">

**Author:** [@chinggis](https://forums.kodeco.com/u/chinggis)\
**Replies:** 3\
**Last updated:** [April 1, 2021, 6:49pm UTC](https://forums.kodeco.com/t/access-to-struct-properties/136192 "2021-04-01T18:49:35Z")

</div>

I completely understand all of the issues regarding the ability of a struct method to read and write the struct’s own properties. My question is, albeit, a beginner’s question. Assuming that, when an instance is created…

---

## [Creating deformed sphere](https://forums.kodeco.com/t/creating-deformed-sphere/136324)

<div class="topic-metadata">

**Author:** [@hcrogman](https://forums.kodeco.com/u/hcrogman)\
**Replies:** 2\
**Last updated:** [April 1, 2021, 10:51am UTC](https://forums.kodeco.com/t/creating-deformed-sphere/136324 "2021-04-01T10:51:17Z")

</div>

In metal sphere is created with this code let sphereMesh = MDLMesh( sphereWithExtent: \[0.4, 0.4, 0.4\], segments: \[10, 10\], inwardNormals: false, geometryType: .triangles, allocator: allocator) How do I create a s…

---

## [Instruction for Swift inverse relationships in Many-to-Many situations](https://forums.kodeco.com/t/instruction-for-swift-inverse-relationships-in-many-to-many-situations/132030)

<div class="topic-metadata">

**Author:** [@dumbbunny](https://forums.kodeco.com/u/dumbbunny)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 3:35am UTC](https://forums.kodeco.com/t/instruction-for-swift-inverse-relationships-in-many-to-many-situations/132030 "2021-04-01T03:35:59Z")

</div>

Is there any instructions for setting up inverse Many-to-Many relationships in Swift on Ray Wenderlich? I found an old video on YouTube, on Beginning Core Data, but for Swift 2, iOS 9, Xcode 7, that was perfect. It show…

---

## [Initialization syntax](https://forums.kodeco.com/t/initialization-syntax/133598)

<div class="topic-metadata">

**Author:** [@galensmith](https://forums.kodeco.com/u/galensmith)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 3:23am UTC](https://forums.kodeco.com/t/initialization-syntax/133598 "2021-04-01T03:23:38Z")

</div>

Explain the purpose of the self initialization syntax such as init(distance: Double) { self.distance = distance } In swiftui when I initialize distance I normally just say init () { var distance = 5 } It seems li…

---

## [Auto Save in SWIFT](https://forums.kodeco.com/t/auto-save-in-swift/135520)

<div class="topic-metadata">

**Author:** [@clash](https://forums.kodeco.com/u/clash)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 3:15am UTC](https://forums.kodeco.com/t/auto-save-in-swift/135520 "2021-04-01T03:15:39Z")

</div>

We have a data driven app in production and need to implement AUTO SAVE during IDLE times. Currently, we see the scroll bar too frequently. Does any one have technical advice?

---

## [Struct property accessibility](https://forums.kodeco.com/t/struct-property-accessibility/135307)

<div class="topic-metadata">

**Author:** [@chinggis](https://forums.kodeco.com/u/chinggis)\
**Replies:** 1\
**Last updated:** [March 29, 2021, 7:44pm UTC](https://forums.kodeco.com/t/struct-property-accessibility/135307 "2021-03-29T19:44:24Z")

</div>

A simple question from a Swift novice. While I completely understand the ability of an internal method to access the struct’s own properties, I’m drawing a blank regarding the ability of an external object to access a s…

---

## [Core Data - FetchRequest Woes: instance member used in param won't run before initializer](https://forums.kodeco.com/t/core-data-fetchrequest-woes-instance-member-used-in-param-wont-run-before-initializer/136328)

<div class="topic-metadata">

**Author:** [@hyoryusha](https://forums.kodeco.com/u/hyoryusha)\
**Replies:** 0\
**Last updated:** [March 29, 2021, 1:55am UTC](https://forums.kodeco.com/t/core-data-fetchrequest-woes-instance-member-used-in-param-wont-run-before-initializer/136328 "2021-03-29T01:55:26Z")

</div>

I want to create a star-based rating display using feedback from users who visit a particular real world landmark. In Core Data I have an entity called Rating with attributes called rating (Int32) and landmark (String). …

---

## [If else question](https://forums.kodeco.com/t/if-else-question/136231)

<div class="topic-metadata">

**Author:** [@drleewood](https://forums.kodeco.com/u/drleewood)\
**Replies:** 0\
**Last updated:** [March 27, 2021, 1:13am UTC](https://forums.kodeco.com/t/if-else-question/136231 "2021-03-27T01:13:38Z")

</div>

Why do I get error: "Cannot convert value of type ‘(Double) → some View’ to expected argument type ‘Double’ " with this code in one of the tutorials: @Environment(\\.colorScheme) var colorScheme . . …

---

## [Using System Sound Kills sound for other apps](https://forums.kodeco.com/t/using-system-sound-kills-sound-for-other-apps/114030)

<div class="topic-metadata">

**Author:** [@flmcl](https://forums.kodeco.com/u/flmcl)\
**Replies:** 1\
**Last updated:** [March 20, 2021, 9:51pm UTC](https://forums.kodeco.com/t/using-system-sound-kills-sound-for-other-apps/114030 "2021-03-20T21:51:40Z")

</div>

When I activate a system sound on my iphone from my swiftUI app the sound works fine. But if I try to play a youtube video there is no sound. The only way I can get sound back is to reset my iphone. Thanks for any help f…

---

## [Make an arithmetic sequence in a if statement](https://forums.kodeco.com/t/make-an-arithmetic-sequence-in-a-if-statement/115921)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 3\
**Last updated:** [March 20, 2021, 4:23pm UTC](https://forums.kodeco.com/t/make-an-arithmetic-sequence-in-a-if-statement/115921 "2021-03-20T16:23:07Z")

</div>

I want to make an arithmetic sequence in a if statement using the contain framework. So instead of writing the in statement like if \[ 30, 60, 90,120\].contains(score) { print(“Winner”) } I want to w…

---

## [Create if statement based on certain time not working in view did appear](https://forums.kodeco.com/t/create-if-statement-based-on-certain-time-not-working-in-view-did-appear/114700)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [March 20, 2021, 4:44pm UTC](https://forums.kodeco.com/t/create-if-statement-based-on-certain-time-not-working-in-view-did-appear/114700 "2021-03-20T16:44:01Z")

</div>

I want my codes background uiviewcontroller background to change depending on the hour. If the code is in the first 60 minutes of the day the background color works. However when the time goes to the second hour the view…

---

## [Create a if statement with a range of ints](https://forums.kodeco.com/t/create-a-if-statement-with-a-range-of-ints/115876)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 5\
**Last updated:** [March 20, 2021, 4:08pm UTC](https://forums.kodeco.com/t/create-a-if-statement-with-a-range-of-ints/115876 "2021-03-20T16:08:49Z")

</div>

I want to make a if statement that equals several different numbers. A example is below that compels but writing score every time could take a lot of time. if score == 4 || score == 5 || score == 6 { print("Yes") I w…

---

## [Text in tutorial seems gibberish](https://forums.kodeco.com/t/text-in-tutorial-seems-gibberish/135409)

<div class="topic-metadata">

**Author:** [@ace.neerav](https://forums.kodeco.com/u/ace.neerav)\
**Replies:** 2\
**Last updated:** [March 18, 2021, 11:20am UTC](https://forums.kodeco.com/t/text-in-tutorial-seems-gibberish/135409 "2021-03-18T11:20:44Z")

</div>

Text in one of the swift tutorial appears gibberish. See screenshot

---

## [Generate Random Number & Update Variable Using A Button](https://forums.kodeco.com/t/generate-random-number-update-variable-using-a-button/132479)

<div class="topic-metadata">

**Author:** [@jbachman](https://forums.kodeco.com/u/jbachman)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 4:25pm UTC](https://forums.kodeco.com/t/generate-random-number-update-variable-using-a-button/132479 "2021-03-01T16:25:39Z")

</div>

Hopefully I am posting this in the right place. I am currently trying to polish up an app I made for HMA Random Sampling using SwiftUI. Right now, when you go into the Random Sample screen, it automatically generates a r…

---

## [Display both front and back views of camera in the same class - Stack Overflow](https://forums.kodeco.com/t/display-both-front-and-back-views-of-camera-in-the-same-class-stack-overflow/133256)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 10:12pm UTC](https://forums.kodeco.com/t/display-both-front-and-back-views-of-camera-in-the-same-class-stack-overflow/133256 "2021-02-25T22:12:51Z")

</div>

I want to display both the front and the back camera views on a single view at the same time (2 separate views in the same single UIView view controller). Right now only the back view is being displayed. I have tried a c…

---

## [Nest a 5 second image over a video before its saved](https://forums.kodeco.com/t/nest-a-5-second-image-over-a-video-before-its-saved/133599)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 0\
**Last updated:** [February 24, 2021, 10:45pm UTC](https://forums.kodeco.com/t/nest-a-5-second-image-over-a-video-before-its-saved/133599 "2021-02-24T22:45:13Z")

</div>

The image called openingScreen i want it combined with the video recorded if that is possible. So openingScreen goes in front of the video for 5 seconds its combined with the recording video and then it is saved to the p…

---

## [Where is "author's notes"?](https://forums.kodeco.com/t/where-is-authors-notes/131177)

<div class="topic-metadata">

**Author:** [@boss280w](https://forums.kodeco.com/u/boss280w)\
**Replies:** 1\
**Last updated:** [February 18, 2021, 6:04pm UTC](https://forums.kodeco.com/t/where-is-authors-notes/131177 "2021-02-18T18:04:00Z")

</div>

I can not find the “author’s notes”,where is it ? tks

---

## [Swift Notification Throughput (Buffer overload?)](https://forums.kodeco.com/t/swift-notification-throughput-buffer-overload/132970)

<div class="topic-metadata">

**Author:** [@mattgaidica](https://forums.kodeco.com/u/mattgaidica)\
**Replies:** 0\
**Last updated:** [February 17, 2021, 7:12pm UTC](https://forums.kodeco.com/t/swift-notification-throughput-buffer-overload/132970 "2021-02-17T19:12:10Z")

</div>

I’m running into some issues sending notifications to an iOS app—up to 5 of them every 250ms, each ~250 bytes. I appears that when all of these are active, the buffer on the iOS end fills to about 5 notifications. The pe…

---

## [HELP ME! My view layout grows and looks bad when it's active -\> Settings -\> Display and brightness -\>Display Zoom -\>View -Zoomed](https://forums.kodeco.com/t/help-me-my-view-layout-grows-and-looks-bad-when-its-active-settings-display-and-brightness-display-zoom-view-zoomed/107200)

<div class="topic-metadata">

**Author:** [@kevvo](https://forums.kodeco.com/u/kevvo)\
**Replies:** 11\
**Last updated:** [February 16, 2021, 5:54am UTC](https://forums.kodeco.com/t/help-me-my-view-layout-grows-and-looks-bad-when-its-active-settings-display-and-brightness-display-zoom-view-zoomed/107200 "2021-02-16T05:54:38Z")

</div>

how to block by programming swift disable → View Zoomed Is there a way to know if a user is using “Display Zoom” feature? I’m talking about this feature and disable option

---

## [Practice apart from the courses](https://forums.kodeco.com/t/practice-apart-from-the-courses/131990)

<div class="topic-metadata">

**Author:** [@anzo73](https://forums.kodeco.com/u/anzo73)\
**Replies:** 2\
**Last updated:** [February 10, 2021, 9:38pm UTC](https://forums.kodeco.com/t/practice-apart-from-the-courses/131990 "2021-02-10T21:38:39Z")

</div>

I am trying to lear swift I have made the iOS video path and the book iOS appretencie, apart from some udemy courses. the problem I have is that I don’t know how to practice alone the thing I have learn. some advice?? …

---

## [UISegmentedControl changing the segment's image tint](https://forums.kodeco.com/t/uisegmentedcontrol-changing-the-segments-image-tint/25948)

<div class="topic-metadata">

**Author:** [@jbreen](https://forums.kodeco.com/u/jbreen)\
**Replies:** 5\
**Last updated:** [January 27, 2021, 6:58pm UTC](https://forums.kodeco.com/t/uisegmentedcontrol-changing-the-segments-image-tint/25948 "2021-01-27T18:58:48Z")

</div>

Hi All, Very new to Swift here. I have a very simple UISegmentedControl where I have set the image for each segment. segmentedControl.setImage(UIImage(named: “cat”), forSegmentAt: 0) segmentedControl.setImage(UIImage…

---

## [Entering debugger in Swift project: couldn't create a ClangImporter](https://forums.kodeco.com/t/entering-debugger-in-swift-project-couldnt-create-a-clangimporter/130829)

<div class="topic-metadata">

**Author:** [@idcrook](https://forums.kodeco.com/u/idcrook)\
**Replies:** 1\
**Last updated:** [January 23, 2021, 12:58am UTC](https://forums.kodeco.com/t/entering-debugger-in-swift-project-couldnt-create-a-clangimporter/130829 "2021-01-23T00:58:11Z")

</div>

For https://www.raywenderlich.com/4681-beginning-ios-debugging/lessons/4 Am getting the following in Xcode when breakpoint hit: Cannot create Swift scratch context (couldn't create a ClangImporter) Am seeing this same…

---

## [Quality in USDZ models](https://forums.kodeco.com/t/quality-in-usdz-models/130382)

<div class="topic-metadata">

**Author:** [@jorge20](https://forums.kodeco.com/u/jorge20)\
**Replies:** 0\
**Last updated:** [January 18, 2021, 8:09am UTC](https://forums.kodeco.com/t/quality-in-usdz-models/130382 "2021-01-18T08:09:13Z")

</div>

Hello, After read the book of augmented reality here in Raywenderlich, I have created an rcproject with some assets. But I see that the quality of the assets (how real they look) decreases a lot when I load it as an ass…

---

## [How to Learn swift](https://forums.kodeco.com/t/how-to-learn-swift/128363)

<div class="topic-metadata">

**Author:** [@anzo73](https://forums.kodeco.com/u/anzo73)\
**Replies:** 2\
**Last updated:** [January 14, 2021, 10:42am UTC](https://forums.kodeco.com/t/how-to-learn-swift/128363 "2021-01-14T10:42:23Z")

</div>

I have been doing some courses outside of ray. And when I put inferno of Xcode I don’t know how to start, I am doing the iOS a beginners road, I think I understand the programming in iOS videos but I don’t know how to tr…

---

## [Video Composition Layer Instruction setCropRectangle with ROTATED rectangle not working as expected](https://forums.kodeco.com/t/video-composition-layer-instruction-setcroprectangle-with-rotated-rectangle-not-working-as-expected/130047)

<div class="topic-metadata">

**Author:** [@vladr](https://forums.kodeco.com/u/vladr)\
**Replies:** 0\
**Last updated:** [January 13, 2021, 3:50pm UTC](https://forums.kodeco.com/t/video-composition-layer-instruction-setcroprectangle-with-rotated-rectangle-not-working-as-expected/130047 "2021-01-13T15:50:58Z")

</div>

For any Core Graphics experts out there, as stated in more detail here: ios - AVMutableVideoCompositionLayerInstruction setCropRectangle with ROTATED rectangle not working as expected - Stack Overflow I want to rotate a…

---

## [Runtime error when taking photo from AVCaputreVideoPReviewLayer](https://forums.kodeco.com/t/runtime-error-when-taking-photo-from-avcaputrevideopreviewlayer/129992)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 0\
**Last updated:** [January 13, 2021, 5:36am UTC](https://forums.kodeco.com/t/runtime-error-when-taking-photo-from-avcaputrevideopreviewlayer/129992 "2021-01-13T05:36:42Z")

</div>

My code is not working and its causing a runtime error. When the takePHoto func is called I dont know how to fix this. import UIKit;import AVFoundation class ViewController: UIViewController { var b1 = UIButton() …

---

## [Episode 29. Variables](https://forums.kodeco.com/t/episode-29-variables/129531)

<div class="topic-metadata">

**Author:** [@kct3937](https://forums.kodeco.com/u/kct3937)\
**Replies:** 0\
**Last updated:** [January 7, 2021, 7:57pm UTC](https://forums.kodeco.com/t/episode-29-variables/129531 "2021-01-07T19:57:05Z")

</div>

Regarding Episode 29, I notice that the pointsForCurrentRound function makes use of a “magic” number …100… when calculating the end result. While you cleaned up the code and made it ‘DRY’, you did not address the issue …

---

## [Dictionary String:AnyObject](https://forums.kodeco.com/t/dictionary-string-anyobject/128761)

<div class="topic-metadata">

**Author:** [@pauldance](https://forums.kodeco.com/u/pauldance)\
**Replies:** 2\
**Last updated:** [December 29, 2020, 3:12pm UTC](https://forums.kodeco.com/t/dictionary-string-anyobject/128761 "2020-12-29T15:12:02Z")

</div>

Hello dear readers, I’m having an issue with dictionaries. I have a this: Key0:Value\\nKey1:Value\\nKey2:Value\\nKey3:Value\\n I would like to create a dictionary with these keys and values. I have written this code for …

---

## [Use a nested for loop to print the items of arrays on buttons](https://forums.kodeco.com/t/use-a-nested-for-loop-to-print-the-items-of-arrays-on-buttons/127904)

<div class="topic-metadata">

**Author:** [@timswift](https://forums.kodeco.com/u/timswift)\
**Replies:** 1\
**Last updated:** [December 29, 2020, 2:43pm UTC](https://forums.kodeco.com/t/use-a-nested-for-loop-to-print-the-items-of-arrays-on-buttons/127904 "2020-12-29T14:43:00Z")

</div>

I wanted to use a nested for loop to display the names of array names on each of the buttons in the for loop. I want to do everything in one loop. Right now my code works but the only name being printed is clear and its …

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

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