I have a basic List row I am building that has a large number on the leading edge followed by a title and subtitle next to it:
I started with a simple implementation, like so:
HStack {
Text("26")
.font(.title)
dispatch_queue_t some_worker_queue = dispatch_queue_create("some_worker_queue", DISPATCH_QUEUE_SERIAL); | |
dispatch_async(some_worker_queue, ^{ | |
// Perform some work | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
dispatch_release(some_worker_queue); | |
}); | |
}); |
// Call this method with [NSDecimalNumber zero] to get negative zero, or NaN. | |
- (NSDecimalNumber *)negativeAmount:(NSDecimalNumber *)anAmount | |
{ | |
if (anAmount == nil) { | |
return [NSDecimalNumber zero]; | |
} | |
NSDecimal decimalAmount = [anAmount decimalValue]; | |
decimalAmount._isNegative = 1; | |
/* | |
(Updated) Many people reached out on Twitter and directed me towards using NSDateComponents | |
as the generally accepted method of incrementing a date. Thanks all! | |
We share a framework between MoneyWell 2.0 (Lion-only) and MoneyWell 1.x (10.5+) that needs | |
to increment a date variable by 1 second. | |
Since addTimeInterval: is deprecated in 10.7 and I hate build warnings as much as everyone | |
else I decided to get fancy with how I go about incrementing a date object. As it turns out |
// Update: The plot thickens! In a Mac project you get the behavior outlined below where dragged and dropped | |
// IBOutlet property creation yields (assign)'ed properties. In an iOS project however, dragged and dropped | |
// IBOutlets get created thusly: | |
@property (retain, nonatomic) IBOutlet UIButton *someButton; | |
// -- Original post begins here: | |
// Since the inception of properties I've written IBOulet properties like so: | |
@property (nonatomic, retain) IBOutlet NSButton *someButton; | |
// Today I dragged and dropped from interface builder to my header file in Xcode 4 to create an outlet and got this: |
// How would I define this constraint in the visual format language? | |
[NSLayoutConstraint constraintWithItem:viewA attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:viewB attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0]; |
@interface SomeViewController () | |
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate | |
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes; | |
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes; | |
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths; | |
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths; | |
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths; | |
@end |
### Keybase proof | |
I hereby claim: | |
* I am MrRooni on github. | |
* I am mrrooni (https://keybase.io/mrrooni) on keybase. | |
* I have a public key whose fingerprint is ED23 9DB4 23B8 A856 3526 8735 B6DD 781D 09F9 C73E | |
To claim this, I am signing this object: |
I'm experiencing a memory usage-based termination in my SwiftUI Apple Watch app. I've traced the problem down to a struct I've created called ImageCycler
.
ImageCycler
is a view that cycles through an array of images, displaying each one for 1.5 seconds before transitioning to the next. When it reaches the end, it starts back at the beginning. It's powered by the ImageCylerModel
. This is how you use it:
struct ImageCycler_Previews: PreviewProvider {
static var previews: some View {
ImageCycler(["Image1", "Image2", "Image3", "Image4"])
}
}