Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reference GSKStretchyHeaderViewSubclass after install with Cocoa Pods #87

Open
julioas09 opened this issue Mar 6, 2018 · 11 comments

Comments

@julioas09
Copy link

julioas09 commented Mar 6, 2018

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!

@gskbyte
Copy link
Owner

gskbyte commented Mar 7, 2018

Hi,

maybe you need to import GSKStretchyHeaderView in your Swift file

@mohamedmontser
Copy link

i already import GSKStretchyHeaderView and still have error

@mohamedmontser
Copy link

@julioas09 is the library works with you now?

@gskbyte
Copy link
Owner

gskbyte commented Mar 7, 2018

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

@mohamedmontser
Copy link

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

@julioas09
Copy link
Author

julioas09 commented Mar 7, 2018

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!

@gskbyte
Copy link
Owner

gskbyte commented Mar 13, 2018

Hi,

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

@mohamedmontser
Copy link

mohamedmontser commented Mar 13, 2018 via email

@daver234
Copy link

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

@gskbyte
Copy link
Owner

gskbyte commented May 24, 2018

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.

@lmorit
Copy link

lmorit commented May 28, 2018

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
    }
    
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants