This file contains 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
enum AppDestination: String { | |
case rectangle | |
case circle | |
} | |
struct ContentView: View { | |
@State private var selected: AppDestination = .circle |
This file contains 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
actor SomeActor { | |
func doSomething() { } | |
} | |
class SomeClass { | |
private let someActor = SomeActor() | |
func doSomething() { | |
Task { // Task-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race |
This file contains 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 | |
protocol DependencyValue { | |
var content: String { get } | |
} | |
@MainActor class Dependency { | |
var value: DependencyValue // NonSendable | |
This file contains 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 | |
@MainActor class Dependency { | |
var value: String | |
nonisolated init(value: String? = nil) { | |
self.value = value ?? "Initial" | |
} | |
This file contains 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
extension UIView { | |
struct EmbedInsets { | |
let top: CGFloat? | |
let left: CGFloat? | |
let right: CGFloat? | |
let bottom: CGFloat? | |
init(top: CGFloat? = nil, bottom: CGFloat? = nil, left: CGFloat? = nil, right: CGFloat? = nil) { | |
self.top = top |
This file contains 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
pod "SNLInteractionTableView", "~> 1.3.0" |
This file contains 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
#pragma mark - SNLInteractionCell delegate | |
- (void)swipeAction:(SNLSwipeSide)swipeSide onCell:(SNLExampleTableViewCell *)cell { | |
// implement actions on successfull swipe gesture | |
if (swipeSide == SNLSwipeSideLeft) { | |
NSLog(@"Left on '%@'", cell.label.text); | |
} | |
else if (swipeSide == SNLSwipeSideRight) { | |
NSLog(@"Right on '%@'", cell.label.text); | |
[self performSegueWithIdentifier:@"detail" sender:self]; |
This file contains 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
/* | |
// to override default/storyboard colors use: | |
self.colorBackground = [UIColor grayColor]; | |
self.colorContainer = [UIColor whiteColor]; | |
self.colorSelected = [UIColor greenColor]; | |
self.colorToolbarBarTint = [UIColor blueColor]; | |
self.colorToolbarTint = [UIColor greenColor]; | |
self.colorIndicator = [UIColor redColor]; | |
self.colorIndicatorSuccess = [UIColor greenColor]; | |
self.colorCustomSeparatorTop = [UIColor whiteColor]; |
This file contains 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
#pragma mark - SNLInteractionTableView delegate - Reorder | |
- (void)startedReorderAtIndexPath:(NSIndexPath *)indexPath { | |
// additional setup when reordering starts | |
NSLog(@"Reordering started"); | |
} | |
// Update your data source when a cell is draged to a new position. This method is called every time 2 cells switch positions. | |
- (void)moveRowFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { | |
// update DataSource when cells are switched |
This file contains 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
UIBarButtonItem *buttonA = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(buttonPressed:)]; | |
buttonA.tag = 1; | |
UIBarButtonItem *buttonB = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(buttonPressed:)]; | |
buttonB.tag = 2; | |
UIBarButtonItem *flexibleItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; | |
[self setToolbarButtons: [NSArray arrayWithObjects:flexibleItem, buttonA, flexibleItem, buttonB, flexibleItem, nil]]; |
NewerOlder