Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Carthage Tutorial: Getting Started

In this Carthage tutorial, you'll learn all about what Carthage is, how to install it, and how to declare, install, and integrate your dependencies.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1607-carthage-tutorial-getting-started

Please make a tutorial which shows how to make our own framework and make it carthage compatible. Thanks.

I’m running through the Tutorial in Swift 3.0, Xcode 8. Having an issue with grabbing the image. I’ve gotten the rest of the project working with Swift 3 and Alamofire 4.

import UIKit
import Alamofire

class DefinitionViewController: UIViewController {

@IBOutlet weak var imageView: RoundedImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!

var definition: Definition!

override func viewDidLoad() {
super.viewDidLoad()

title = definition.title
descriptionLabel.text = definition.description
    if let imageURL = definition.imageURL {
        Alamofire.request(imageURL).response {
            response in
            self.activityIndicator.stopAnimating()
            let image = UIImage(data: response)   <----ERROR HERE
            self.imageView.image = image
        }
    }

}

override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}

}

I’m getting the error, "Cannot convert value of type ‘DefaultDataResponse’ to expected argument type ‘Data’

I have scoured the internet and I’m having trouble finding a solution to this. Thanks. P.S. Total beginner here.

Hi, you need to add a little:
if let imageURL = definition.imageURL {
Alamofire.request(imageURL).response { response in
self.activityIndicator.stopAnimating()

    if let data = response.data,
      let image = UIImage(data: data) {
      self.imageView.image = image
    }
  }
}

Hi, I have notice that the size of my project increases because of the .frameworks generated from the Cartfile. Do you think its necessary to keep all the files and folders generated by the Cartfile build in the project? For instance I notice some files like A.framework.dSYM (symbol files I believe), do I need these files in my project as they all contribute to the .ipa size.

Do you know if we can use something like “subspecs” in Carthage?

Can you please update this to the latest Xcode and swift version?

I get the following error when trying to run the app after inserting the framework:

dyld: Library not loaded: @rpath/Turbolinks.framework/Turbolinks
  Referenced from: /Users/hugohyz/Library/Developer/CoreSimulator/Devices/.../Test1.app/Test1
  Reason: image not found
(lldb)

I’m trying to insert the Turbolinks framework.