Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
79 views

If you bridge C or Objective-C to Swift, you can misuse _Nonnull to falsely make a guarantee to Swift that a value never holds nil. However, suppose I have this situation in Swift: var nonoptional: ...
CPlus's user avatar
  • 5,110
1 vote
1 answer
71 views

When I run my code I receive this error: /Users/ayaangrover/Documents/Github/waffle/Waffle/Waffle/ContentView.swift:46:19 Initializer for conditional binding must have Optional type, not 'String'. ...
Ayaan Grover's user avatar
-1 votes
1 answer
78 views

Help me understand this weird nil-check. I have a variable of the type Int? and I need to switch on nil. This makes sense: buildFrameId is 3 and not equal to nil This does not: buildFrameId is nil ...
esbenr's user avatar
  • 1,563
1 vote
1 answer
159 views

This is an additional scenario for the question and answer covered here. Sample code is available here. Original problem was related to this predicate: let aPred = #Predicate<Event> { ...
grep's user avatar
  • 594
1 vote
2 answers
421 views

I need to display and allow the editing of a class whose members are mostly optional. This does not appear to be a scenario that SwiftUI envisions, despite Apple propagating the "single source of ...
Oscar's user avatar
  • 2,614
0 votes
1 answer
38 views

Can anyone help: The code works on iOS simulator (iPhone 13mini) chrashes on real iPhone 13mini: Fatal error: Unexpectedly found nil while unwrapping an Optional value. I don't understand how "...
SebastianH's user avatar
1 vote
1 answer
99 views

This currently works, but in xcode-beta it is now showing a warning: Same-type requirement makes generic parameter 'Value' non-generic; this is an error in Swift 6 func getUDValue<Value, R>(_ ...
Doghound's user avatar
  • 139
0 votes
2 answers
795 views

I want to execute javascript in an external screen's webview. In my main view I'm trying to call the pop() function in the External View like this: let ex = ExternalDisplayViewController() ex.pop(str: ...
Josiah's user avatar
  • 1,137
0 votes
1 answer
148 views

I have created a class class NewTabContainerModal { var newContainerDate = Date() var newContainerSelectedFilter : NewAllErrorFIlter = .Yearly func resetModal () { newContainerSelectedFilter = ....
Rohit's user avatar
  • 2,336
0 votes
0 answers
58 views

I have my struct as: struct CategoryViewModel2: Codable { let data: [Datum2]? } // MARK: - Datum struct Datum2: Codable { let the0: Int? let the1, the2: String? let the3, the4, id: ...
Kuldeep Vashist's user avatar
0 votes
0 answers
28 views

I created a label to show the current date when the view loads, but when I transition to another view, I get the: Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional ...
Pedro's user avatar
  • 1
1 vote
1 answer
483 views

So if have an array of ToDos and the Todo objects have the properties due(Bool) which has the info if the ToDo has a due date; dueDate(Date) which is an optional so if due is true dueDate != nil, if ...
Timothy's user avatar
  • 27
0 votes
1 answer
419 views

I wrote an extension to Decodable with the hopes of having a generic constructor for objects from json strings, it looks like this: extension Decodable { init?(with dictionary: [String: Any]) { ...
Sebby Fay's user avatar
  • 211
1 vote
1 answer
6k views

I've been investigating this error for a while and I am still struggling to find an answer. I understand the concept behind this error yet I don't understand why it is still notifying me even though I ...
Garfunklefinn's user avatar
0 votes
1 answer
134 views

I am following the Stanford CS193 SwiftUI iOS Development Course on YouTube and I am having a very difficult time comprehending how a certain piece of the code is working. import Foundation struct ...
phast's user avatar
  • 212
1 vote
1 answer
515 views

I am new to Swift programming and am trying to make a simple app that presents a Challenge which you can then complete by pressing a button. Then in a separate view controller you unlock images when ...
the-happy-coder's user avatar
0 votes
1 answer
179 views

I have a simple task for JS, and I have no idea how to make it using Swift. Help me please to understand and make this. I need just check if state value is or not nil, and disable the button. Button(...
Andrey Nadosha's user avatar
1 vote
1 answer
239 views

I am trying to get more Structure into my code so I am implementing this UserDefaultsService: class UserDefaultsService { let defaults = UserDefaults(suiteName: UserDefaults.Keys.groupKey) ...
Chris's user avatar
  • 2,404
-1 votes
1 answer
44 views

I'm stuck with an issue and need your help. I'm working on an app to manage events and when app loads, all the posts are displayed as expected both with or without images into the post. If I add a new ...
EddieF's user avatar
  • 81
1 vote
2 answers
571 views

Hi I'm trying to learn Swift using Apples Fundamentals of Swift book. There has been a similar post in the past but I have some problems with the answer provided that I would like clarified. The post ...
JGW's user avatar
  • 43
-1 votes
1 answer
550 views

I'm trying to detect clicks on links in a WKWebView and load the corresponding URLs in another WKWebView. I'm able to get the URL of the click and create a URL request but loading the URLRequest ...
Ismaël Sow's user avatar
-2 votes
1 answer
56 views

I am moving a card game written in Objective-C to Swift. I have 2 arrays in my Hand class, both of size 3, one holding the 3 side-by-side down cards and the other holding the up cards that are on top ...
BillDay's user avatar
-1 votes
2 answers
850 views

We are trying to make a function to get JSON from an API..We know that this is giving us NIL but we dont know why the error is occuring. The exact error message that we got was [] 2020-08-01 16:29:26....
Codestudio365's user avatar
0 votes
2 answers
721 views

I'm trying to extend optionals into something readable, and achieved this so far: @discardableResult func isNotNil(_ handler: (Wrapped) -> Void) -> Optional { switch self { ...
bhagat's user avatar
  • 38
0 votes
2 answers
720 views

I have a model that looks like: public struct Profile { public let bio: String? public let company: String public let createdDate: Date public let department: String public let email: ...
Harry Blue's user avatar
  • 4,562