This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. EXC_BAD_ACCESS (code=2) always means `Stack Overflow` | |
| 2. bt in Xcode lldb for backtrace. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| final class StreamListner { | |
| private let stream: AsyncStream<Int> = AsyncStream<Int> { (continuation) in | |
| Task { | |
| for i in 1...20 { | |
| try? await Task.sleep(for: .seconds(2)) | |
| continuation.yield(i) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Changes in construction parameters cause the view's body to re-evaluate regardless of that | |
| parameter is using in the body or not. | |
| SwiftUI cannot determine whether this change will cause value of body to change or not, it will blindly re-evalute the body. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // LegentView.swift | |
| // DifferentSmallTests | |
| // | |
| // Created by Arun's Macbook on 22/01/26. | |
| // | |
| // Support only one line for Legend Text right now. | |
| import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // SKScene+Edges.swift | |
| // SafeAreaEdges | |
| // | |
| // Created by Arun on 21/12/25. | |
| // | |
| import SpriteKit | |
| // Make sure to access through `viewDidLayoutSubviews` method of ViewController. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Displaying a bubble that follows the slider thumb using the `anchorPreference` and | |
| `overlayPreferenceValue` modifiers in SwiftUI. | |
| */ | |
| import SwiftUI | |
| struct OverlayPreferenceKey: PreferenceKey { | |
| typealias Value = Anchor<CGRect>? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| There is a bug in SwiftUI, some how ignoreSafeArea(.top) don't work when you add PageStyle TabView inside NavigationStack. | |
| This bug is reproduceable in minimum iOS 16.6 | |
| Solution: Just add color to TabView. | |
| */ | |
| struct ContentView: View { | |
| var body: some View { | |
| myTabView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import SwiftUI | |
| extension View { | |
| @ViewBuilder | |
| func shimmer(when isLoading: Bool) -> some View { | |
| if isLoading { | |
| self.modifier(Shimmer()) | |
| .redacted(reason: .placeholder) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func execute() { | |
| let numberChannel = AsyncChannel<Void>() | |
| let alphabetsChannel = AsyncChannel<Void>() | |
| Task { | |
| var iterator = (1...10).makeIterator() | |
| for await _ in numberChannel { | |
| if let number = iterator.next() { | |
| print(number, terminator: " ") | |
| await alphabetsChannel.send(()) |
NewerOlder