Skip to main content
1 vote
1 answer
311 views

I want to create a Swift macro that doesn’t return a value to be inserted somewhere; I want a macro that simply substitutes code in its place. Specifically, I want to avoid constantly repeating the ...
Nikita's user avatar
  • 13
1 vote
1 answer
80 views

I am trying to refactor this code: @objc protocol BaseDelegate { func xxx() } protocol DerivedDelegate: BaseDelegate { func yyy() } protocol NextDerivedDelegate: BaseDelegate { func zzz()...
Bawenang Rukmoko Pardian Putra's user avatar
1 vote
1 answer
237 views

I got a timer for uploading logs,here is the code: - (void)setupTimer { if (_timerForRecording) { dispatch_source_cancel(_timerForRecording); _timerForRecording = NULL; } ...
Santiago's user avatar
  • 608
0 votes
2 answers
513 views

I have some mock code that performs a retain cycle (or at least in my mind it should). Here it is: protocol MyService { func perform(completion: @escaping () -> Void) } class MyServiceImpl: ...
Alexandru Motoc's user avatar
0 votes
1 answer
136 views

I have a problem and do not know what to do. My FirstViewController calls with let secondVC = SecondViewController() let navController = UINavigationController(rootViewController: secondVC) ...
Nuri's user avatar
  • 95
3 votes
2 answers
1k views

I am already aware of the strong/weak reference concept in swift. yet after running the next code, and tapping on the Button (and dismissing the screen), the TestViewModel stayed in memory! I was ...
vigdora's user avatar
  • 433
1 vote
1 answer
1k views

Here is a very simple code example that reproduces a memory leak when deleting an item in SwiftUI List. This is reproducible on iOS 15 and iOS 16 (at least). Item's are never deallocated even if they ...
josip04's user avatar
  • 234
0 votes
0 answers
74 views

I am building a macOS Document based application. I am following Apple's example code, which can be found here. In Apple's example, the NSDocument assigns itself as the NSViewController's ...
Daniel Higgott's user avatar
0 votes
2 answers
577 views

I'm trying to understand the memory leak situation in Swift language but there is a situation that I'm still wondering. I've created a new UIViewController and call fetch function with storing the ...
Thanapat Sorralump's user avatar
0 votes
1 answer
88 views

class ViewModel { ... func state(with bindings: @escaping (Driver<State>) -> Signal<Event>) -> Driver<State> { Driver.system( initialState: .initial, ...
hydro1337x's user avatar
0 votes
1 answer
342 views

Does a UIAlertAction's handler need a [weak self] or [unowned self] to avoid a retain cycle, or is it fine to keep it as a strong reference? e.g. extension UIViewController { func showAlert() { ...
shim's user avatar
  • 10.4k
2 votes
0 answers
144 views

I have a View which contains some kind of a controller. I need to have ability to trigger View's method from the controller. But I am getting retain cycle that I can't solve. Such View never destroy ...
bodich's user avatar
  • 2,303
0 votes
0 answers
780 views

For context, the goal of the code below is to intercept a particular type of link inside a webview and handle navigation across a tabview natively (to a separate webview displaying the desired page) ...
Chris's user avatar
  • 959
0 votes
1 answer
70 views

I am building a settings screen in an app where I have a list of cells. If a user taps on a cell it pushes another controller onto the stack. However, I have this flow in several places in my app. ...
David Henry's user avatar
  • 3,110
0 votes
1 answer
526 views

I installed llvm and use scan-build to statically analyze a very simple demo project. In this project, I intentionally created a retain cycle and Xcode can immediately display a retain cycle warning ...
P. Tsin's user avatar
  • 597

15 30 50 per page
1
2 3 4 5
21