GSKStretchyHeaderView icon indicating copy to clipboard operation
GSKStretchyHeaderView copied to clipboard

Can't reference GSKStretchyHeaderViewSubclass after install with Cocoa Pods

Open julioas09 opened this issue 6 years ago • 11 comments

Hi, maybe I'm missing something and you can help me. I'm installing using Cocoa Pods. My podfile looks like this:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'Project' do
    pod 'GoogleMaps'
    pod 'GooglePlaces'
    pod 'GSKStretchyHeaderView'
    pod 'FacebookCore'
    pod 'FacebookLogin'
end

After I do a 'pod install' successfully, i cant't reference GSKStretchyHeaderViewSubclass. If I write var stretchyHeader: GSKStretchyHeaderViewSubclass! I get the error "Use of undeclared type". I'm probably missing something, but I can't find the solution...

Thanks!

julioas09 avatar Mar 06 '18 19:03 julioas09

Hi,

maybe you need to import GSKStretchyHeaderView in your Swift file

gskbyte avatar Mar 07 '18 13:03 gskbyte

i already import GSKStretchyHeaderView and still have error

mohamedmontser avatar Mar 07 '18 13:03 mohamedmontser

@julioas09 is the library works with you now?

mohamedmontser avatar Mar 07 '18 14:03 mohamedmontser

I think you need to add a bridging header, because this component is written in Objective-C:

https://github.com/gskbyte/GSKStretchyHeaderView/blob/master/Example/GSKStretchyHeaderView/Example-Bridging-Header.h

gskbyte avatar Mar 07 '18 15:03 gskbyte

@gskbyte great thanks for you but the problem with me and @julioas09 (maybe) is we do not have view called GSKStretchyHeaderViewSubclass

mohamedmontser avatar Mar 07 '18 16:03 mohamedmontser

Thanks. after adding those lines to the bridging header, that error goes away, however, when trying to build the project I get the following error:

screen shot 2018-03-07 at 22 28 17

I understand those are files included in the example, which are not added when installing the pod package. Which would be the right approach to be able to use the library properly in a swift project?

Thank you!

julioas09 avatar Mar 07 '18 21:03 julioas09

Hi,

to be honest I can't really help as this depends on the configuration of your project. Have you tried with Carthage?

gskbyte avatar Mar 13 '18 16:03 gskbyte

i use cocoa pods not Carthage

On Tue, Mar 13, 2018 at 6:55 PM, Jose Alcalá Correa < [email protected]> wrote:

Hi,

to be honest I can't really help as this depends on the configuration of your project. Have you tried with Carthage?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gskbyte/GSKStretchyHeaderView/issues/87#issuecomment-372738392, or mute the thread https://github.com/notifications/unsubscribe-auth/Ac9sV1UMNNkedNCT5LbV8AXeDlfYAPkqks5td_oCgaJpZM4SfU9r .

mohamedmontser avatar Mar 13 '18 17:03 mohamedmontser

I have this same problem after doing the first install. Did anyone find an answer to this question?

daver234 avatar May 24 '18 02:05 daver234

Hi, if you are importing this library in a Swift project, you just need to @import GSKStretchyHeaderView; in your bridging header. All other example files are obviously not needed, because they belong only to the example project.

gskbyte avatar May 24 '18 16:05 gskbyte

I think what you missed is that you have to create a new class that is a subclass of GSKStretchyHeaderView, in the example they called this custom class GSKStretchyHeaderViewSubclass.

Example:

use var stretchyHeader: HeaderView!

And write your custom class HeaderView.swift

import GSKStretchyHeaderView

class HeaderView: GSKStretchyHeaderView {
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        // you can change wether it expands at the top or as soon as you scroll down
        self.expansionMode = .immediate
        
        // You can change the minimum and maximum content heights
        self.minimumContentHeight = 64 // you can replace the navigation bar with a stretchy header view
        self.maximumContentHeight = 280
        
        // You can specify if the content expands when the table view bounces, and if it shrinks if contentView.height < maximumContentHeight. This is specially convenient if you use auto layout inside the stretchy header view
        self.contentShrinks = true
        self.contentExpands = false // useful if you want to display the refreshControl below the header view
        
        // You can specify wether the content view sticks to the top or the bottom of the header view if one of the previous properties is set to `false`
        // In this case, when the user bounces the scrollView, the content will keep its height and will stick to the bottom of the header view
        self.contentAnchor = .bottom
    }
    
}

lmorit avatar May 28 '18 22:05 lmorit