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

Embedded Content Contains Swift Code with Xcode 8 Beta

I am developing a command line macOS application(with Objective-C) which uses other 3rd party Swift libraries. I am retrieving an error says “dyld: Library not loaded: @rpath/libswiftAppKit.dylib“ Previous answers recommend to set “Embedded Content Contains Swift Code” flag to true. However, this flag is missing with Xcode 8 beta. I have tried “ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES“, which i […]

Parse geopoint swift not getting current location

trying to use parses PFGeoPoint.geoPointForCurrentLocationInBackground to get current location when i send something to my backend. The code looks like NSLog(“Before block”) PFGeoPoint.geoPointForCurrentLocationInBackground { (geoPoint: PFGeoPoint!, error: NSError!) -> Void in NSLog(“inside block”) if !error { // do something with the new geoPoint } } and I never get my inside block on the console. […]

Accessing global const CGFloat defined in an Objective-c .m file from Swift

I have defined some constants in my .m files that I need to access form my swift code. They are defined: const CGFloat testValue = 40.0; and in my other objective-c .m files I can access them by using extern: extern const CGFloat testValue Is there an equivalent way of making these constants accessible from […]

How to properly implement lazy instantiation with an @IBOutlet property in Swift

I am Learning iOS Development with Big Nerd Ranch’s latest iOS book. I have chosen to implement their apps in Swift. In one of their apps, they have the following code in Objective C: – (UIView *)headerView { // If you have not loaded the header view yet… if (!_headerView) { // Load HeaderView.xib [[NSBundle […]

FBSDKLoginManager code from Objective-C to swift

Any one please help me how to convert the FBSDKLoginManager code into swift programming Thanks in advance here i attached the code in Objective-C – (IBAction)btnFacebookPressed:(id)sender { FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; login.loginBehavior = FBSDKLoginBehaviorBrowser; [login logInWithReadPermissions:@[@”email”] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { // Process error } else if (result.isCancelled) { // […]

Best way to avoid capturing a copy of the value in closure

struct Foo { var i = 0 { didSet { println(“Current i: \(i)”) } } func delayedPrint() { dispatch_async(dispatch_get_main_queue(), { _ in println(“Closure i: \(self.i)”) }) } mutating func foo() { delayedPrint() i++ } } Now the output of var a = Foo() is Current i: 1 Closure i: 0 // I want current […]

“deprecated from Graph API 2.9” warnings for FBSDKShareLinkContent properties

When I try to pass an FBSDKShareLinkContent to an FBSDKMessageDialog, it returns with warnings for some properties, saying that those are deprecated from Graph API 2.9. ‘imageURL’ is deprecated: imageURL is deprecated from Graph API 2.9 ‘contentTitle’ is deprecated: contentTitle is deprecated from Graph API 2.9 ‘contentDescription’ is deprecated: contentDescription is deprecated from Graph API […]

Proper usage of RxSwift to chain requests, flatMap or something else?

Firs of whole I’m new to rxswift so I guess the answer is obvious however at the moment I can’t find solution by myself. I have two functions: func downloadAllTasks() -> Observable<[Task]> func getTaskDetails(taskId: Int64) -> Observable<TaskDetails> First one is downloading the list of Task objects using network request, second one downloading task details for […]

How to Declare a Multidimensional Boolean array in Swift?

I’ve seen so many different examples on how to do this but none of them seem to show an answer that I really need. So I know how to declare a multidimensional array of type bool. var foo:[[Bool]] = [] However I cannot figure out how to declare this of type 10 x 10. Every […]

How to set an initial value for @NSManaged property PFObject Subclass?

I have a subclass of PFObject called Attendee. In this class, there is a instance variable I have called isFavorite. Below is its class definition: @NSManaged var isFavorite: Bool This is an instance var that is local to the device and I never sync it up to the server. In addition, I never explicitly instantiate […]