Xcode: Is there a difference between a framework and a pod in the project?

Viewed 1554

I'm just getting started with Xcode and iOS development. I am supposed to reproduce an iOS project on a tvOS. One of the frameworks is JSQCoreDataKit

In the original iOS project, this framework exists in two places:
PODS:.
enter image description here
FRAMEWORKS.
enter image description here

I installed the framework following the manual instructions in this link.
So in the new project, it is installed as a normal framework:
enter image description here.

The problem I have faced is : Some of the code that works in the original project, relies on a code that is defined in the PODS folder:
EXAMPLE:

func saveChanges() {
    stack.mainContext.performAndWait {
        saveContext(self.stack.mainContext)
    }
}

saveContext function exists in:

enter image description here

And this is its definition(just in case):

public func saveContext(_ context: NSManagedObjectContext, wait: Bool = true, completion: ((SaveResult) -> Void)? = nil) {
    let block = {
        guard context.hasChanges else { return }
        do {
            try context.save()
            completion?(.success)
        }
        catch {
            completion?(.failure(error as NSError))
        }
    }
    wait ? context.performAndWait(block) : context.perform(block)
}

So while in the original project where Pods exists, this works fine.
In the new project, where it doesn't exist, and the framework is installed manually, I get this error:

Use of unresolved identifier 'saveContext'

But, the framework gets imported successfully with no errors :

import JSQCoreDataKit

One last thing, adding the framework with the manual method described in this link doesn't make it appear in here:
enter image description here

1 Answers

Hii i also had the same issue which i solved !!

So Framework and pod is different. Pod = Library

When to use them ??

1.Framework - Use it When you want to Hide the logic in the Code. Mostly used in Banking Frameworks. In framework no files and folders are visible everything is hidden.

2.Pod - Mostly used so that you can share your code and people can also see it and edit it.Files and Folder Structure is also visible.

Just go to youtube and search for How to create framework. How to create Library. Youwill get it.

Hope you get it!

Related