[Solved] Unrecognized selector sent to instance for my tap gesture

You don’t know how to make the correct selector for this method. (It would be “didtapContainerViewWithGesture:”, but clearly you don’t know that.) So don’t try. Use #selector syntax and let the compiler form the selector for you! Just say #selector(didtapContainerView). Done. 0 solved Unrecognized selector sent to instance for my tap gesture

[Solved] Dynamic key value type

You have to decode data depending on type. That means you have to first decode type and then continue depending on its value. Usually to store such items we would use an enum with associated values: enum Item: Decodable { case onboarding(OnboardingData) case entry(EntryData) init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) … Read more

[Solved] autolayout- different devices and rotation

Yes, auto layout will do it. you might want to take a look at this tutorial to get started: https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 1 solved autolayout- different devices and rotation

[Solved] Swift – how to read data from many UITextFields which generate data by UIPickerView [closed]

You can set a pickerView as the textField.inputView. The example below is for two text fields sharing a single picker view, but you can extend it easily by checking the identity of the activeTextField in the picker view delegate methods. import UIKit class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { @IBOutlet weak var myTextFieldOne: UITextField! @IBOutlet weak … Read more

[Solved] what is the delegate of these NSURLSession methods in Swift?

If you type this into Playground: class Downloader : NSObject, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate { } and then start typing inside the class URLS you get all the autocompletion stuff. Try that and if this does not work restart Xcode. Maybe “cleaning” the project will also help. Please also note that the methods you reference in your … Read more

[Solved] How can I check array count changes in Swift [closed]

Property observers observe and respond to changes in a property’s value. Property observers are called every time a property’s value is set, even if the new value is the same as the property’s current value. You have the option to define either or both of these observers on a property: willSet is called just before … Read more

[Solved] How to create a shared navigation bar to inter-navigate among multiple views in SwiftUI? [closed]

You would use a TabView {…} to accomplish this. Effectively you instantiate your views inside of the TabView then add an item modifier to each view. var body: some View { TabView { Text(“A”) .tabItem { Text(“A”) } Text(“B”) .tabItem { Text(“B”) } Text(“C”) .tabItem { Text(“C”) } } init() { UITabBar.appearance().backgroundColor = UIColor.red } … Read more

[Solved] Cannot convert value of type ‘NSData’ to type ‘Date’ in coercion in json work? [closed]

1- Replace this let jsonObject = try JSONSerialization.jsonObject(with: data as Date, options: .allowFragments) with let jsonObject = try JSONSerialization.jsonObject(with: data as Data, options: .allowFragments) it’s a Data object not Date 2- no need for fragments it can be let jsonObject = try JSONSerialization.jsonObject(with: data as Data, options: []) if let object = jsonObject as? [NSString: … Read more

[Solved] I want to just use a simple for loop

You are trying to achieve the following: import Foundation let input = [“VALUE ACTIVITY”, “BONUS ACTIVITY”, “JACKPOT EVENTS”, “VALUE ACTIVITY”, “JACKPOT EVENTS”] var output = [String]() for element in input { if element.contains(“VALUE ACTIVITY”) { output.append(element.replacingOccurrences(of: “VALUE ACTIVITY”, with: “Value”)) } else if element.contains(“JACKPOT EVENTS”) { output.append(element.replacingOccurrences(of: “JACKPOT EVENTS”, with: “Jackpot”)) } else if element.contains(“BONUS … Read more