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

Getting list of files in documents folder

What is wrong with my code for getting the filenames in the document folder? func listFilesFromDocumentsFolder() -> [NSString]?{ var theError = NSErrorPointer() let dirs = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true) as? [String] if dirs != nil { let dir = dirs![0] as NSString let fileList = NSFileManager.defaultManager().contentsOfDirectoryAtPath(dir, error: theError) as [NSString] return fileList }else{ return nil } […]

Importing CommonCrypto in a Swift framework

How do you import CommonCrypto in a Swift framework for iOS? I understand how to use CommonCrypto in a Swift app: you add #import <CommonCrypto/CommonCrypto.h> to the bridging header. However, Swift frameworks don’t support bridging headers. The documentation says: You can import external frameworks that have a pure Objective-C codebase, a pure Swift codebase, or […]

How to present popover properly in iOS 8

I’m trying to add a UIPopoverView to my Swift iOS 8 app, but i am unable to access the PopoverContentSize property, as the popover does not show in the correct shape. my code: var popover: UIPopoverController? = nil func addCategory() { var newCategory = storyboard.instantiateViewControllerWithIdentifier(“NewCategory”) as UIViewController var nav = UINavigationController(rootViewController: newCategory) popover = UIPopoverController(contentViewController: […]

Code Sign Error in macOS Sierra Xcode 8.3.3 – resource fork, Finder information, or similar detritus not allowed

Already tried : Code Sign Error on macOS Sierra, Xcode 8 Please see image showing error CodeSign /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ cd “/Volumes/Development/Project/Top Best Games/19. Lets Flow/35/let’s FLOW – source/proj.ios_mac” export CODESIGN_ALLOCATE=/Applications/ export PATH=”/Applications/” Signing Identity: “iPhone Distribution: New Free Games (2CHN583K4J)” Provisioning Profile: “Super Flow Flipp AppStore” (c6c30d2a-1025-4a23-8d12-1863ff684a05) /usr/bin/codesign –force –sign E48B98966150110E55EAA9B149F731901A41B37F –entitlements /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Intermediates/\ Flow\ […]

UIImageView – How to get the file name of the image assigned?

Is it possible to read the name of an UIImageView’s UIImage that’s presently stored in the UIImageView? I was hoping you could do something kind of like this, but haven’t figured it out. NSString *currentImageName = [MyIImageView getFileName];

NSFetchedResultsController with predicate ignores changes merged from different NSManagedObjectContext

I am presenting table view contents using NSFetchedResultsController which has a predicate: [NSPredicate predicateWithFormat:@”visible == %@”, [NSNumber numberWithBool:YES]] On background thread using separate NSManagedObjectContext I update few of the entities and change theirs visible value from NO to YES. Save, merge changes in main thread’s NSManagedObjectContext. But NSFetchedResultsController‘s fetchedObjects doesn’t change. Also controller doesn’t call […]

Figure out size of UILabel based on String in Swift

I am trying to calculate the height of a UILabel based on different String lengths. func calculateContentHeight() -> CGFloat{ var maxLabelSize: CGSize = CGSizeMake(frame.size.width – 48, CGFloat(9999)) var contentNSString = contentText as NSString var expectedLabelSize = contentNSString.boundingRectWithSize(maxLabelSize, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: [NSFontAttributeName: UIFont.systemFontOfSize(16.0)], context: nil) print(“\(expectedLabelSize)”) return expectedLabelSize.size.height } Above is the current function I use […]

How to implement tab bar controller with navigation controller in right way

I am using Storyboard and Xcode 6. I have next controllers and scenes in my Storyboard: UINavigationController that has HomeViewController as a root. HomeViewController has a button that Show (e.g. Push) UITabBarController. UITabBarController has 4 UIViewControllers. But my problem that after I Show UITabBarController there are no Navigation Bars in 4 UIViewControllers. But I supposed […]

Get a list of all contacts on iOS

I want to get a list of all contacts of an iPhone. I checked Address Book reference, I may missed something but I didn’t see it provides a method to get a list of contacts.

appearanceWhenContainedIn in Swift

I’m trying to convert my app to the Swift language. I have this line of code: [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:textDictionary forState:UIControlStateNormal]; How to convert it to Swift? In Apple’s docs, there is no such method.