GSKStretchyHeaderView
GSKStretchyHeaderView copied to clipboard
Can't reference GSKStretchyHeaderViewSubclass after install with Cocoa Pods
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!
Hi,
maybe you need to import GSKStretchyHeaderView
in your Swift file
i already import GSKStretchyHeaderView and still have error
@julioas09 is the library works with you now?
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 great thanks for you but the problem with me and @julioas09 (maybe) is we do not have view called GSKStretchyHeaderViewSubclass
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:
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!
Hi,
to be honest I can't really help as this depends on the configuration of your project. Have you tried with Carthage?
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 .
I have this same problem after doing the first install. Did anyone find an answer to this question?
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.
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
}
}