swift5 Questions

12

Solved

I'm trying to use Swift's @testable declaration to expose my classes to the test target. However I'm getting this compiler error: Intervals is the module that contains the classes I'm trying to ex...
Spatiotemporal asked 11/6, 2015 at 17:36

4

Solved

I am trying to install cocoapods in my mac system but Unfortunately not able to install due to below error. I have already used below commands. sudo gem install -n /usr/local/bin cocoapods --p...
Gloria asked 3/4, 2020 at 9:16

1

Solved

I am transferring photo peer to peer. All things works fine but I am not able to get the photo(file) transfer speed i.g internet speed. Like MB the file is transferred. Second I want to fetch the s...
Chickpea asked 9/1, 2022 at 16:2

1

I want to implement an Airplay button that shows the Bluetooth, iPhone option like in the iPhone music app we click on Airplay. I did some of the code but I am facing some issues. As I implement, ...
Merkle asked 4/3, 2021 at 18:49

2

Solved

I'm trying to run this async function on Xcode Playground: import Foundation import PlaygroundSupport PlaygroundPage.current.needsIndefiniteExecution = true enum NetworkingError: Error { case in...
Slavish asked 16/6, 2021 at 14:18

7

I have set a view's leading, trailing constraints normally. I have set its height to static 325. And for bottom constraint I have set 2 constraints 1. with main view's bottom constraint to view's b...
Copper asked 14/10, 2019 at 12:3

1

Solved

I am using the new Swift 5.5 features to create an async function: @MainActor @objc func updateStatus() async { /// do async stuff... } But when I try to call this method from Objective-C code, i...
Seafaring asked 23/11, 2021 at 18:30

2

Solved

I want to use Firebase with Swift 5, but error message appears. Could not build Objective-C module 'Firebase' I tried all resolutions on below pages, but I can't solve it: Error: Could not bu...
Jeane asked 7/9, 2019 at 17:37

5

From Swift 5, new case attribute @unknown is introduced. What is the exact difference when @unknown is being used and not being used? In which case we have to use @unknown keyword?
Dees asked 29/3, 2019 at 6:7

2

In this case the async function reads a file and returns the parsed contents. In my view I want to load the contents off of the main thread, and then update the view once complete. I've used this p...
Electroshock asked 28/10, 2021 at 12:17

3

Solved

I created WKWebView that doesn't have one url. User use this WKWebView as Safari means user can search anything on WKWebView. I am facing one issue when I change dark and light mode my web view wil...
Nubbin asked 3/11, 2021 at 19:14

1

Solved

Let's say I have the following functions. func first() async { print("first") } func second() { print("second") } func main() { Task { await first() } second() } main()...

2

Solved

I'm just picking up SwiftUI after a long break but I don't understand why I can't place a Navigation View within a Tab View. I want my Navigation View to be a .tabItem so the view appears as part o...
Kid asked 23/4, 2021 at 22:3

7

Solved

The SwiftUI tutorial uses the @State keyword to indicate mutable UI state: @State var showFavoritesOnly = false It offers this summary: State is a value, or a set of values, that can change ov...
Adversity asked 4/6, 2019 at 6:50

1

Solved

I am creating a Swift Package that will flash some text for a specified duration (like a toast implementation.) I want the user to have the option to specify a background shape in the call to the i...
Bichromate asked 16/9, 2021 at 20:25

7

Solved

I'm a swift learner. I work with SwiftUI which is a struct, I have to implement a WKWebView and in that, a url is changing dynamically. I have to catch these changing urls, but solutions I have tri...
Lippmann asked 11/10, 2019 at 7:41

1

Solved

The following code is legal in Swift 5.5 (beta): class Dog { var name = "rover" var friend : Dog? = nil } actor MyActor { let dog = Dog() } func test() async { let act = MyActor() ac...
Lisabeth asked 20/8, 2021 at 15:28

2

Solved

I'm trying to create a LazyVGrid view to display the contents of objects in an array using nested ForEach statements. The code is causing an app crash with the message "Fatal error: each layou...
Integral asked 27/8, 2020 at 21:2

1

Solved

I need to use my own custom error enum in tasks that I create: enum MyError: Error { case someError } var myTask: Task<MyModel, MyError> = Task { () throws -> MyModel in // in case of a...
Hypoacidity asked 17/8, 2021 at 12:24

3

Solved

Using Swift 5.2 I would like to create a function to dynamically change the Shape I have a view like import SwiftUI struct CardView: View { let suit : Suite let rank : Rank var body: some Vi...
Wingspread asked 29/4, 2020 at 13:49

5

Solved

In Swift 4 we could use var md5: String? { guard let data = self.data(using: .utf8) else { return nil } let hash = data.withUnsafeBytes { (bytes: UnsafePointer<Data>) -> [UInt8] in var...
Calamanco asked 26/3, 2019 at 11:37

1

Solved

I'm new to Swift, coming from JS, and I've started to build an iOS app. Initially I went down the road, using Promise Kit for the async stuff, as it seemed easier to me than other things I read abo...
Fetlock asked 13/7, 2021 at 23:14

5

I'm trying to set colour for placeholder text inside UISearchbar. Right now I've following code. It doesn't set white colour to placeholder text on iOS 13. It works on iOS 12. It seems something ...
Frame asked 26/10, 2019 at 18:32

2

Using Realitykit, trying to change the material of moon Entity to a custom .jpg and then tapping the screen to spawn that object based off hitTest. Nothing shows up when I tap and getting the follo...
Calvary asked 1/6, 2020 at 19:45

1

Solved

I am scratching my head on new async/await pattern in Swift 5.5 announced in WWDC 2021 and there seems to be lot of learning involved and not as easy to grasp as is pretended to be. I just saw this...
Jonquil asked 27/6, 2021 at 8:59

© 2022 - 2024 — McMap. All rights reserved.