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:
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:
I expected to be able to write:
firstly {
deleteEvents()
}.then {
createEvents()
}.done {
}
I'm feeling stuck. Can anyone help?