ios - Facebook Pop fragment from Obj-C into Swift -
working on departed coworkers project. need implement objective-c code facebook pop animation swift. paste in entirety since few lines long. i've looked @ few tutorials being new @ pop , swift has made tricky. how write in swift?
- (void)scaledownview:(uiview *)view { popspringanimation *scaleanimation = [popspringanimation animationwithpropertynamed:kpoplayerscalexy]; scaleanimation.tovalue = [nsvalue valuewithcgsize:cgsizemake(0.1, 0.1)]; scaleanimation.springbounciness = 6.f; [view.layer pop_addanimation:scaleanimation forkey:@"scaleanimation"]; }
i'm assuming you've added bridging header project in question. imported #import <pop/pop.h>
in bridging header. you'll have import pop
@ top of swift
file you'd use below method.
func scaledownview(view: uiview) { let scaleanimation = popspringanimation(propertynamed:kpoplayerscalexy) scaleanimation.tovalue = nsvalue(cgsize: cgsize(width: 0.1, height: 0.1)) scaleanimation.springbounciness = 6.0 view.layer.pop_addanimation(scaleanimation, forkey: "scaleanimation") }
Comments
Post a Comment