swift5 Questions
2
Solved
I've been facing following issue (it's just a warning) with my iOS project.
'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'ActiveType' to 'Hashable' by implementing ...
3
Solved
Update 2: I suspect the question gets upvoted because of the possible solution that I describe. Highlighted it for clarity.
Update 1: This question gets a lot of views. If you think the question ca...
Aleman asked 13/10, 2021 at 13:13
2
Solved
I want to keep firing a function 5 seconds after it completes.
Previously I would use this at the end of the function:
Timer.scheduledTimer(withTimeInterval: 5, repeats: false) { self.function() }
...
Cristacristabel asked 11/8, 2021 at 15:9
5
Solved
I never get this before, What is the meaning of this error message in Swift:
No exact matches in call to instance method 'dataTask(with:completionHandler:)'
Here is my code block:
var request: NS...
12
Solved
I have a framework (in this instance it's RxSwift) which I've compiled using Xcode 11.0 into the traditional RxSwift.framework style package
This imported fine into Xcode 11.0 and also 11.1 never ...
1
Solved
I am trying to learn the swift concurrency but it brings in a lot of confusion. I understood that a Task {} is an asynchronous unit and will allow us to bridge the async function call from a synchr...
Geum asked 29/9, 2022 at 13:38
1
Solved
I have a @State variable and async function. I want to call the async function whenever that variable is changed.
Basically, what I am trying to do
VStack {
Text("")
}
.onChange(of: v...
3
let manager = SocketManager(socketURL: URL(string: "Some url")!, config: [.log(true), .compress])
var socket:SocketIOClient!
var name: String?
var resetAck: SocketAckEmitter?
override ...
6
Solved
I'm trying out the new async/await stuff. My goal here is to run the test() method in the background, so I use Task.detached; but during test() I need to make a call on the main thread, so I'm usin...
Ably asked 10/6, 2021 at 2:17
2
This is sort of a follow-up to my earlier asyncDetached falling back into main thread after MainActor call.
Here's the complete code of an iOS view controller:
import UIKit
func test1() {
print(&...
Xanthippe asked 13/6, 2021 at 2:48
2
Solved
When I opened my project in Xcode 10.2, I got this message:
Unsupported Swift Version
…Use Xcode 10.1 to migrate the code to Swift 4.
Where can I still find Xcode 10.1? So the process is to have ...
2
Solved
I have 2 functions where one basically retrieves string in User Defaults and another writes the string in User Defaults. I'm not able to understand that should I do the unit test or no? and I'm pre...
Sociology asked 22/1, 2020 at 2:8
2
Solved
I have a UITextField that has the "Secure Text Entry" checked in my storyboard.
When I assign the text of the UITextField.text property to a variable I get a value of:
class name = _NSClS...
2
Solved
After retagging a git commit I'm no longer able to fetch the package, because SP Manager uses some cache which I can't find and clean. Getting error:
Revision 30c16cab9c718416fee2191ff2ac0b6f91eeb...
Inebriant asked 28/6, 2022 at 14:11
2
Solved
I cleared the title from attribute inspector, but while running the app, text "Button" is displaying.
Output:
I checked different scenarios and the issue occurs only if the deployment t...
0
I'd like to know the install state of my iOS safari extension in the associated swift app. Is there any way to get this?
SFSafariExtensionManager and getStateOfSafariExtension here only seems valid...
Tutt asked 10/5, 2022 at 21:7
1
Solved
I read in HackingWithSwift that Swift tuples can be compared with == operator only when the number of elements is less than or equal to 6. What is the reason behind this limitation ?
1
I use firebase dynamic links. They work perfectly fine when the app is in background and I use the application continue userActivity function.
However if I click on a dynamic link and cold start t...
Sangfroid asked 17/10, 2019 at 17:42
4
Solved
I just learned Swift and developed an iOS project.
But the button title doesn't change when I click it. How can I change the title?
Simulator: iPhone 11 iOS14.4
This is the code:
import UIKit
cl...
7
How can I add an additional property based on a condition?
With my code below I get the error:
Cannot assign value of type 'some View' (result of 'Self.overlay(_:alignment:)') to type 'some View' ...
2
Solved
Can't find any documentation of this issue.
One of my apps has a text view with a .minimumScaleFactor(0.5). This works perfectly in iOS 14.0.* - when the text would be wider than the view its scale...
Athwart asked 26/9, 2021 at 13:15
2
Solved
I'm seeing onChange(of: Bool) action tried to update multiple times per frame warnings when clicking on NavigationLinks in the sidebar for a SwiftUI macOS App.
Here's what I currently have:
import ...
Dilemma asked 4/3, 2022 at 0:55
6
After update to Swift 5.2 / Xcode 11.4 got a warning to following code:
extension Data {
init<T>(from value: T) {
var value = value
let pointer = UnsafeBufferPointer(start: &value, c...
Holster asked 25/3, 2020 at 21:38
2
Solved
Given the setup I've outlined below, I'm trying to determine why ChildView's .onChange(of: _) is not receiving updates.
import SwiftUI
struct SomeItem: Equatable {
var doubleValue: Double
}
stru...
Veasey asked 12/2, 2022 at 0:56
4
When conforming to protocols or overriding superclass methods, you may not be able to change a method to be async, but you may still want to call some async code. For example, as I am rewriting a p...
Horne asked 11/6, 2021 at 20:31
© 2022 - 2024 — McMap. All rights reserved.