pub struct ViewController<T> {
    pub objc: ShareId<Object>,
    pub view: View<T>,
}
Expand description

A ViewController is a wrapper around NSViewController in AppKit, and UIViewController in UIKit

This type is interchangeable with a standard View<T>, in that using this simply forwards standard view controller lifecycle methods onto your ViewDelegate. You would use this if you need to be notified of when something is going to be used (e.g, for lifecycle event-based cleanup routines, or something).

Example

use cacao::view::ViewDelegate;

struct ContentViewDelegate;

impl ViewDelegate for ContentViewDelegate {
    const NAME: &'static str = "ContentViewDelegate";

    fn will_appear(&self, animated: bool) {
        println!("This controller is about to appear!");
    }
}

Fields

objc: ShareId<Object>

The underlying Objective-C pointer.

view: View<T>

The underlying View that we manage.

Implementations

Creates and returns a new ViewController with the provided delegate.

Trait Implementations

Returns the underlying Objective-C object.

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.