52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

Changing the background effect of the drawer from another swift file #308

Closed ipoogleduck closed 5 years ago

ipoogleduck commented 5 years ago

Sorry if this is a stupid question, I'm new to swift. I was wondering if it's possible to change the drawerBackgroundVisualEffectView variable from extraLight to dark and so forth within my class for the drawer in a separate swift file. I am trying to make it switch between a light and dark theme at a certain time.

amyleecodes commented 5 years ago

Yes, you can modify it as long as you have a reference to Pulley.

If you’ve imported Pulley in your file (and you’re trying to modify it from within your drawer or primary content view controller) you can use the convenience accessory of “self.pulleyViewController” to access the nearest PulleyViewController that contains your view controller.

ipoogleduck commented 5 years ago

Sorry, I'm still confused If I wanted the drawer to turn dark would I put "drawerBackgroundVisualEffectView = .dark" ? And then where would "self.pulleyViewController" fit in?

amyleecodes commented 5 years ago

self.pulleyViewController.drawerBackgroundVisualEffectView =

However, it doesn’t take a value of “.dark”. You’ll need to create an instance of UIVisualEffectView. Take a look at the apple docs on UIVisualEffectView for how to set that up.

ipoogleduck commented 5 years ago

Thanks! It works now!