---
title: GLKViewController
framework: glkit
role: symbol
role_heading: Class
path: glkit/glkviewcontroller
---

# GLKViewController

A view controller that manages an OpenGL ES rendering loop.

## Declaration

```swift
class GLKViewController
```

## Overview

Overview A GLKViewController object works in conjunction with a GLKView object to display frames of animation in the view, and also provides standard view controller functionality. To use this class, allocate and initialize a new GLKViewController subclass and set its view property to point to a GLKView object. Then, configure the view controller’s preferredFramesPerSecond property to the desired frame rate your application requires. You can set a delegate or configure other properties on the view controller, such as whether the animation loop is automatically paused or resumed when the application moves into the background. note: When you set the view property to point to a GLKView object, if the view does not already have a delegate, then the view controller is automatically set as the view’s delegate. When active, rendering loop automatically updates the view’s contents each time a new frame must be displayed. Each frame is rendered by the view controller using these steps: The view controller calls its delegate’s glkViewControllerUpdate(_:) method. Your delegate should update frame data that does not involve rendering the results to the screen. The view controller calls its view’s display() method. Your view should redraw the frame. Subclassing Notes Your application should subclass GLKViewController and override the viewDidLoad() and viewDidUnload methods. Your viewDidLoad method should set up your context and any drawable properties and can perform other resource allocation and initialization. Similarly, your class’s viewDidUnload method should delete the drawable object and free any unneeded resources. As an alternative to implementing a glkViewControllerUpdate(_:) method in a delegate, your subclass can provide an update method instead. The method must have the following signature: - (void)update;

## Topics

### Configuring the Frame rate

- [preferredFramesPerSecond](glkit/glkviewcontroller/preferredframespersecond.md)
- [framesPerSecond](glkit/glkviewcontroller/framespersecond.md)

### Configuring the Delegate

- [delegate](glkit/glkviewcontroller/delegate.md)

### Controlling Frame Updates

- [isPaused](glkit/glkviewcontroller/ispaused.md)
- [pauseOnWillResignActive](glkit/glkviewcontroller/pauseonwillresignactive.md)
- [resumeOnDidBecomeActive](glkit/glkviewcontroller/resumeondidbecomeactive.md)

### Obtaining Information About View Updates

- [framesDisplayed](glkit/glkviewcontroller/framesdisplayed.md)
- [timeSinceFirstResume](glkit/glkviewcontroller/timesincefirstresume.md)
- [timeSinceLastResume](glkit/glkviewcontroller/timesincelastresume.md)
- [timeSinceLastUpdate](glkit/glkviewcontroller/timesincelastupdate.md)
- [timeSinceLastDraw](glkit/glkviewcontroller/timesincelastdraw.md)

## Relationships

### Inherits From

- [UIViewController](uikit/uiviewcontroller.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [GLKViewDelegate](glkit/glkviewdelegate.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSExtensionRequestHandling](foundation/nsextensionrequesthandling.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [UIActivityItemsConfigurationProviding](uikit/uiactivityitemsconfigurationproviding.md)
- [UIAppearanceContainer](uikit/uiappearancecontainer.md)
- [UIContentContainer](uikit/uicontentcontainer.md)
- [UIFocusEnvironment](uikit/uifocusenvironment.md)
- [UIPasteConfigurationSupporting](uikit/uipasteconfigurationsupporting.md)
- [UIResponderStandardEditActions](uikit/uiresponderstandardeditactions.md)
- [UIStateRestoring](uikit/uistaterestoring.md)
- [UITraitChangeObservable](uikit/uitraitchangeobservable-67e94.md)
- [UITraitEnvironment](uikit/uitraitenvironment.md)
- [UIUserActivityRestoring](uikit/uiuseractivityrestoring.md)

## See Also

### OpenGL ES View Rendering

- [GLKView](glkit/glkview.md)
- [GLKViewDelegate](glkit/glkviewdelegate.md)
- [GLKViewControllerDelegate](glkit/glkviewcontrollerdelegate.md)
