<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKViewDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(pl)SKViewDelegate"
  },
  "title" : "SKViewDelegate"
}
-->

# SKViewDelegate

Methods to take custom control over the view’s render rate.

```
protocol SKViewDelegate : NSObjectProtocol
```

## Overview

By setting a SpriteKit view’s `delegate` with an object that implements [`SKViewDelegate`](/documentation/SpriteKit/SKViewDelegate), you can precisely control the frame rate of a game or app. You may choose to do this to maintain a consistent frame rate for computationally intensive code or for special effects such as simulating cine film.

The following Swift code shows an example of a class that implements the SpriteKit view delegate protocol to reduce the frame rate to a specified value. With each call of [`view(_:shouldRenderAtTime:)`](/documentation/SpriteKit/SKViewDelegate/view(_:shouldRenderAtTime:)), it checks the time since the last render and if that value exceeds the required frame duration (`1 / fps`), the method returns <doc://com.apple.documentation/documentation/Swift/true> and the frame is rendered.

```swift
class ViewDelegate: NSObject, SKViewDelegate {
    var lastRenderTime: TimeInterval = 0
    
    let fps: TimeInterval = 3
    
    public func view(_ view: SKView, shouldRenderAtTime time: TimeInterval) -> Bool {

        if time - lastRenderTime >= 1 / fps {
            lastRenderTime = time
            return true
        }
        else {
            return false
        }
        
    }
}
```

The return value of [`view(_:shouldRenderAtTime:)`](/documentation/SpriteKit/SKViewDelegate/view(_:shouldRenderAtTime:)) doesn’t change the speed of physics simulations and actions in a SpriteKit scene. However, if you return <doc://com.apple.documentation/documentation/Swift/false>, SpriteKit will skip updates and [`SKSceneDelegate`](/documentation/SpriteKit/SKSceneDelegate) methods are not called.

## Topics

### Instance Methods

[`view(_:shouldRenderAtTime:)`](/documentation/SpriteKit/SKViewDelegate/view(_:shouldRenderAtTime:))

Specifies whether the view should render at the given time.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)