iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Swift – Retrieving subviews

In my application I am adding labels to the view and then I am attempting to clear particular labels from the view when a button is clicked and am running into an error when trying to retrieve the subviews: class FirstViewController: UIViewController { @IBAction func btnAddTask_Click(sender: UIButton){ var subViews = self.subviews.copy() } } I get […]

Swift error with generic array

I have a very simple playground: protocol MyProtocol {} struct MyType: MyProtocol {} class MyClass <T: MyProtocol> { func myFunction(array: [T]) { if let myArray = array as? [MyType] { println(“Double!”) } } } let instance = MyClass<MyType>() let array = [MyType(), MyType()] instance.myFunction(array) Then it says “MyType is not a subtype of ‘T’” on […]

Swift 3 warning: Non-optional expression of type 'String' used in a check for optionals

I’m updating a project to Swift 3 and came across the following warning which I can’t seem to resolve. fileprivate var filteredTitlesList: [String] = [] if let filteredTitle: String = filteredTitlesList[indexPath.row] as String { // ‘Non-optional expression of type ‘String’ used in a check for optionals’ // Do something } The answer to a similar […]

Set shouldAutorotate to false with Photolibrary

If I add a popover with access to my photo gallery from the iPad the system always crash with the following message: Terminating app due to uncaught exception ‘UIApplicationInvalidInterfaceOrientation’, reason: ‘Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES’ But I already set up in my Projekt Information just […]

How to get All the sundays in Array of date ios

i just want an array who contain all the Mondays in the year in the form of NSDate but in swift. i am using the folowing code in the objective -c but dont know how to user it in swift. NSDate *pickerDate = [NSDate date]; NSLog(@”pickerDate: %@”, pickerDate); NSDateComponents *dateComponents; NSCalendar *calendar = [NSCalendar currentCalendar]; […]

dyld symbol not found DictionaryGenerator (IOS Xcode6 Beta4)

I having below log error after compile with latest Xcode6 Beta4 version. However there is not problem with Xcode6 Beta3. I have not idea on what the error message is about. I’m new to xcode. Please assist. dyld: Symbol not found: __TMPdVSs19DictionaryGenerator Referenced from: /private/var/mobile/Containers/Bundle/Application/512B4D3F-F81E-42EF-9FD9-D808B066A833/* Expected in: /private/var/mobile/Containers/Bundle/Application/512B4D3F-F81E-42EF-9FD9-D808B066A833/ in /private/var/mobile/Containers/Bundle/Application/512B4D3F-F81E-42EF-9FD9-D808B066A833/* Thanks in advance.

Escaping backslash in Swift

I’m sending regular expressions to CloudKit as a String value and it doesn’t seem to like it, replacing \\by \. However, once I’m getting this value from my app I would like to retransform it in its original form, with \\instead of \. I don’t know how to manage this kind of escaped characters in […]

Presenting a View Controller with a button in a UITableViewCell programmatically (Swift)

I am trying to make it where when a user clicks on a table view cell in my table view it takes them to a new view controller. More specifically, when a user clicks on a persons username it should take them to that users profile. the username being the table view cell and the […]

Swift filter for multiple dictionary keys

I’m making a search bar for my app. I’m using the filter method to get the results. I want to search through multiple keys. Array of dictionaries: var people = [ [“First”: “John”, “Last”: “Doe”], [“First”: “Steve”, “Last”: “Jobs”], [“First”: “Elon”, “Last”: “Musk”] ] I am only able to search for either “First” or “Last”, […]

Is it possible to use iOS 11 Drag and Drop to reorder multiple items/cells at a time in UITableView?

I know it’s possible to reorder a single item/cell at a time when using the new UITableViewDropDelegate and UITableViewDragDelegate delegates but is it possible to support handling multiple. For example in this screenshot I am holding a single item: And dropping the cell puts it in to place. However when I grab multiple cells I […]