---
title: "init(viewModel:oldViewModel:animated:)"
framework: CareKit
role: symbol
role_heading: Initializer
platforms: [iOS 13.0+, Mac Catalyst 13.0+, watchOS 7.0+]
path: "carekit/ocksynchronizationcontext/init(viewmodel:oldviewmodel:animated:)"
---

# init(viewModel:oldViewModel:animated:)

Creates a new context.

## Declaration

```swift
init(viewModel: ViewModel, oldViewModel: ViewModel, animated: Bool)
```

## Parameters

- `viewModel  `: The current view model value.
- `oldViewModel  `: The previous view model value.
- `animated  `: A Boolean value that indicates whether updating the context should be animated.
