ZacharyKhan / ZKCarousel

A simple carousel implementation written in Swift
MIT License
289 stars 57 forks source link

Getting Value of type 'UIView' has no member 'addSubView' error #13

Closed HamdyAli closed 6 years ago

HamdyAli commented 6 years ago

I copied the usage code as shown in the instructions but when I build it returns the error "Value of type 'UIView' has no member 'addSubView'". I'm currently using Xcode 9.3 with Swift 4.

HamdyAli commented 6 years ago

The whole code looks like this: `import UIKit import ZKCarousel

class ViewController: UIViewController {

let carousel : ZKCarousel = {
    let carousel = ZKCarousel()

    // Create as many slides as you'd like to show in the carousel
    let slide = ZKCarouselSlide(image: UIImage(), title: "Hello There 👻", description: "Welcome to the ZKCarousel demo! Swipe left to view more slides!")
    let slide1 = ZKCarouselSlide(image: UIImage(), title: "A Demo Slide ☝🏼", description: "lorem ipsum devornum cora fusoa foen sdie ha odab ebakldf shjbesd ljkhf")
    let slide2 = ZKCarouselSlide(image: UIImage(), title: "Another Demo Slide ✌🏼", description: "lorem ipsum devornum cora fusoa foen ebakldf shjbesd ljkhf")

    // Add the slides to the carousel
    carousel.slides = [slide, slide1, slide2]

    return carousel
}()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    self.carousel.frame = CGRect()
    view.addSubView(self.carousel)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}`

thewozz commented 6 years ago

Change this view.addSubView(self.carousel) into --> self.view.addSubview(self.carousel) The letter V should be v.

ZacharyKhan commented 6 years ago

Did @thewozz answer your problem?

ZacharyKhan commented 6 years ago

Closing due to inactivity. If your issue persists, please open another one.