Wednesday, February 8, 2023
HomeiOS Developmentios - I want to create bit comparability predicate for coredata. I'm...

ios – I want to create bit comparability predicate for coredata. I’m utilizing a 32bit worth as argument however it modifications worth when creating predicate


personal func buildPredicateForMonths(monthFilter:Int16) -> NSPredicate? {
        // monthsFilter isn't zero as each tour has a month
        let monthFilter32 : UInt32 = UInt32(monthFilter)
print("monthFilter32: (monthFilter32)")
        let predicate:NSPredicate = NSPredicate(format: "(months & %i) != 0", [monthFilter32])
print("predicate: (predicate.description)")
        return predicate
}

the output from that is:

monthFilter32: 4095
predicate: months & -2119600160 != 0

I would really like the predicate to be
predicate: months & 4095 != 0

I’m considering this can be a results of %i however can not discover documentation on what I want right here?

Thanks

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments