Skip to content

Commit

Permalink
Auto merge of #226 - grovesNL:class-macro, r=jdm
Browse files Browse the repository at this point in the history
Use new objc class macro

This PR removes the `class` function in favor of the [new `class` macro exposed by objc](SSheldon/rust-objc#65) which caches access by class name. Note that this macro should eventually (through procedural macros) be able to link directly to the class.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/226)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo authored Jul 17, 2018
2 parents 8787854 + 82978bf commit 2bea7c7
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 101 deletions.
2 changes: 1 addition & 1 deletion cocoa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ block = "0.1"
bitflags = "1.0"
libc = "0.2"
core-graphics = { path = "../core-graphics", version = "0.15" }
objc = "0.2"
objc = "0.2.3"
4 changes: 2 additions & 2 deletions cocoa/examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular,

use core_graphics::display::CGDisplay;

use objc::runtime::{Class, Object, Sel};
use objc::runtime::{Object, Sel};
use objc::declare::ClassDecl;

fn main() {
Expand Down Expand Up @@ -44,7 +44,7 @@ fn main() {
app_menu_item.setSubmenu_(app_menu);

// Create NSWindowDelegate
let superclass = Class::get("NSObject").unwrap();
let superclass = class!(NSObject);
let mut decl = ClassDecl::new("MyWindowDelegate", superclass).unwrap();

extern fn will_use_fillscreen_presentation_options(_: &Object, _: Sel, _: id, _: NSUInteger) -> NSUInteger {
Expand Down
Loading

0 comments on commit 2bea7c7

Please sign in to comment.