update README for new API

This commit is contained in:
Mitchell Hashimoto 2023-10-20 22:50:33 -07:00
parent 4b54a6fad5
commit 98597c6903
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC

View file

@ -51,14 +51,14 @@ const objc = @import("objc");
pub fn macosVersionAtLeast(major: i64, minor: i64, patch: i64) bool { pub fn macosVersionAtLeast(major: i64, minor: i64, patch: i64) bool {
/// Get the objc class from the runtime /// Get the objc class from the runtime
const NSProcessInfo = objc.Class.getClass("NSProcessInfo").?; const NSProcessInfo = objc.getClass("NSProcessInfo").?;
/// Call a class method with no arguments that returns another objc object. /// Call a class method with no arguments that returns another objc object.
const info = NSProcessInfo.msgSend(objc.Object, objc.sel("processInfo"), .{}); const info = NSProcessInfo.msgSend(objc.Object, "processInfo", .{});
/// Call an instance method that returns a boolean and takes a single /// Call an instance method that returns a boolean and takes a single
/// argument. /// argument.
return info.msgSend(bool, objc.sel("isOperatingSystemAtLeastVersion:"), .{ return info.msgSend(bool, "isOperatingSystemAtLeastVersion:", .{
NSOperatingSystemVersion{ .major = major, .minor = minor, .patch = patch }, NSOperatingSystemVersion{ .major = major, .minor = minor, .patch = patch },
}); });
} }