问题标签 [swift-array]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
860 浏览

swift - Swift - Search using UISearchController and NSPredicate with an array of structs

Currently I'm trying to set up a search bar for my tableView. I want to filter the user's input with NSPredicate to display filtered data from an array of struct objects.

But when I try to call .filteredArrayUsingPredicate() on such an array, I get the following error [Course] is not convertible to 'NSArray'.

Below is my code and a link to the repo. I'm also open to any better methods of approach.

Link: https://github.com/classmere/app/tree/feature/issue/1/implementSearch

Many Thanks!

0 投票
0 回答
35 浏览

ios - 以正确的顺序保存和检索图像

我正在尝试将一些图像保存到一个数组中,并将它们的名称作为字符串保存到另一个数组中,代码如下;

但它不会以我保存的相同顺序检索图像,同时以正确的顺序检索 CountryNamesArray。

我应该使用自定义类来保存带有字符串的图像还是有什么方法可以解决?