PromiseKit manual installation

300 Views Asked by At

I am new to programming. Therefore, installing PromiseKit has been difficult for me. Upon investigating the various installation methods, I attempted to install via Carthage (unsuccessfully it turned out because than I had to figure out how to install Carthage, which I was never able to do).

I then tried to install manually since it appeared simpler. While the instructions say to "You can just drop PromiseKit.xcodeproj into your project and then add PromiseKit.framework to your app’s embedded frameworks," even that is unclear to me.

I ended up dropping it here:

Finder Image

This seemed to work because now when type "import" at the top of my ViewController.swift file, PromiseKit appears as a viable answer.

However, here is where things go bad. Based on the documentation, I expect to be able to write code like this:

firstly { 
login() 
}.then { creds in 
fetch(avatar: creds.user) 
}.done { image in 
self.imageView = image }

So, I went to the code for the button in my app.

@IBAction func AddElectionEvents(_ sender: UIButton) { 
       deleteEvents() 
       createEvents() 
}

I want to use PromiseKit to first delete my events and then create new events. When I type firstly, however, this is what I see:

enter image description here

I expected to be able to write:

  firstly { 
    deleteEvents() 
  }.then { 
    createEvents() 
  }.done { 
  }

I'm feeling stuck. Can anyone help?

1

There are 1 best solutions below

0
On

I agree with the comments that trying to use PromiseKit straight off when your learning is not going to make your life easy. The same applied to any 3rd party API that brings in a new paradigm.

Having said that all your code samples and images look file to me. It's clear that you have PromiseKit installed properly because Xcode's code completion is seeing it.

What is missing from your question is the actual problem. You say it's not working, but don't actually say what's going wrong. Is there an error? Does it not compile? Or run? Or is it that things are not executing the way you expect, and if so, what do you expect and what's actually happening?

Apart from that, I'd suggest you actually remove PromiseKit at this stage. Go back to basics. There's no reason why your code could not be run without PromiseKit so do that first, once that's all good. You could look at PromiseKit again from a point of view of how will it help make your app better.