Post

Replies

Boosts

Views

Activity

Reply to Resetting a NSPredicate
After a while being stucked with this problem, I finally found the solution in 5 minutes : When a NSSearchField is cleared, 2 functions are called : controlTextDidChange and searchFieldDidEndSearching. So I just add a control to check if the filter string count is equal to 0 to reset the filter : private func _filterTracks(str: String) { if str.count == 0 { resetFilter() return } var thePredicates = [NSPredicate]() let theArtistPredicate = NSPredicate(format: FilterType.format, FilterType.artistField, str) let theTitlePredicate = NSPredicate(format: FilterType.format, FilterType.titleField, str) let theAlbumPredicate = NSPredicate(format: FilterType.format, FilterType.albumField, str) if(_currentFilter?.tag == FilterType.FilterListType.ALL.rawValue){ thePredicates.append(theArtistPredicate) thePredicates.append(theTitlePredicate) thePredicates.append(theAlbumPredicate) }else if(_currentFilter?.tag == FilterType.FilterListType.artist.rawValue){ thePredicates.append(theArtistPredicate) }else if(_currentFilter?.tag == FilterType.FilterListType.album.rawValue){ thePredicates.append(theAlbumPredicate) }else if(_currentFilter?.tag == FilterType.FilterListType.title.rawValue){ thePredicates.append(theTitlePredicate) } let theCompoundPredicate = NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.or, subpredicates: thePredicates) arrayController.filterPredicate = theCompoundPredicate print("V&G_Project____filterTracks : ", arrayController.filterPredicate?.predicateFormat) } func resetFilter() { searchField.stringValue = "" // in case the func is called from another func arrayController.filterPredicate = nil } Et voila... So that's right it is arrayController.filterPredicate = nil to reset the predicate. Thx.
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to Xcode 12 Beta 5 arm 64 issue as building for iOS Simulator, but linking in dylib built for iOS
Hi, Same problem here with an 3 years old iOS project I've been working on for 3 days with a MacBook Pro M2 : Building for iOS Simulator, but linking in dylib built for iOS, file ... for architecture arm64 If I understood well, it is because the CocoaPod library isn't compatible with the ARM processor. I tried to upgrade the library from CocoaPod but same problem, CocoaPod isn't compatible with ARM processor, I need to upgrade Ruby and so on... But all the projects libraries exist as a Git repo (I have to check) so if I migrate from CocoaPods to Swift Package Manager (which what it will have to be done anyway) as described in many articles, it will be fine right ? Thx.
Nov ’22