I am looking to programmatically change the height of a today extension. As the iOS10 SDSK introduced NCWidgetDisplayMode I am trying to use it to programmatically change the height of my preferredContentSize.
I have implemented widgetActiveDisplayModeDidChange:
@available(iOSApplicationExtension 10.0, *)
func widgetActiveDisplayModeDidChange(activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) {
    if (activeDisplayMode == NCWidgetDisplayMode.Compact) {
        self.preferredContentSize = maxSize
    }
    else {
        self.preferredContentSize = CGSize(width: maxSize.width, height: 280)
    }
}
I want the widget height to expand when a UIButton is pressed :
@IBAction func multiplybyonethousand (sender: AnyObject) {
    if self.extensionContext?.widgetActiveDisplayMode == NCWidgetDisplayMode.Compact {
        self.widgetActiveDisplayModeDidChange(.Expanded, withMaximumSize: CGSizeMake(0, 300))
    }
}
However when I run my code, the height of the today extension does not change and the console gives me the following error:
2016-11-05 14:24:29.425697 todayextension[28590:7222420] No active animation block!
I have tried to call widgetActiveDisplayModeDidChange inside an animation block:
@IBAction func multiplybyonethousand (sender: AnyObject) {
        if self.extensionContext?.widgetActiveDisplayMode == NCWidgetDisplayMode.Compact {
            UIView.animateWithDuration(0.2, delay: 0, options: .CurveLinear, animations: { () -> Void in
                self.widgetActiveDisplayModeDidChange(.Expanded, withMaximumSize: CGSizeMake(0, 300))
            }) { (completed) -> Void in
             //Do Stuff
            }
        }
}
But I still get the No active animation block! error message. Is there a way to programmatically expand a today extension view in iOS10 ?
 
     
    