objc2_event_kit/generated/EKRecurrenceDayOfWeek.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// Class which represents a day of the week this recurrence will occur.
11 ///
12 /// EKRecurrenceDayOfWeek specifies either a simple day of the week, or the nth instance
13 /// of a particular day of the week, such as the third Tuesday of every month. The week
14 /// number is only valid when used with monthly or yearly recurrences, since it would
15 /// be otherwise meaningless.
16 ///
17 /// Valid values for dayOfTheWeek are integers 1-7, which correspond to days of the week
18 /// with Sunday = 1. Valid values for weekNumber portion are (+/-)1-53, where a negative
19 /// value indicates a value from the end of the range. For example, in a yearly event -1
20 /// means last week of the year. -1 in a Monthly recurrence indicates the last week of
21 /// the month.
22 ///
23 /// The value 0 also indicates the weekNumber is irrelevant (every Sunday, etc.).
24 ///
25 /// Day-of-week weekNumber values that are out of bounds for the recurrence type will
26 /// result in an exception when trying to initialize the recurrence. In particular,
27 /// weekNumber must be zero when passing EKRecurrenceDayOfWeek objects to initialize a weekly
28 /// recurrence.
29 ///
30 /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkit/ekrecurrencedayofweek?language=objc)
31 #[unsafe(super(NSObject))]
32 #[derive(Debug, PartialEq, Eq, Hash)]
33 pub struct EKRecurrenceDayOfWeek;
34);
35
36unsafe impl NSCoding for EKRecurrenceDayOfWeek {}
37
38unsafe impl NSCopying for EKRecurrenceDayOfWeek {}
39
40unsafe impl CopyingHelper for EKRecurrenceDayOfWeek {
41 type Result = Self;
42}
43
44unsafe impl NSObjectProtocol for EKRecurrenceDayOfWeek {}
45
46unsafe impl NSSecureCoding for EKRecurrenceDayOfWeek {}
47
48impl EKRecurrenceDayOfWeek {
49 extern_methods!(
50 #[cfg(feature = "EKTypes")]
51 /// Creates an autoreleased object with a day of the week and week number of zero.
52 #[unsafe(method(dayOfWeek:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn dayOfWeek(day_of_the_week: EKWeekday) -> Retained<Self>;
55
56 #[cfg(feature = "EKTypes")]
57 /// Creates an autoreleased object with a specific day of week and week number.
58 #[unsafe(method(dayOfWeek:weekNumber:))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn dayOfWeek_weekNumber(
61 day_of_the_week: EKWeekday,
62 week_number: NSInteger,
63 ) -> Retained<Self>;
64
65 #[cfg(feature = "EKTypes")]
66 /// Creates an day-of-week object with a specific day of week and week number.
67 #[unsafe(method(initWithDayOfTheWeek:weekNumber:))]
68 #[unsafe(method_family = init)]
69 pub unsafe fn initWithDayOfTheWeek_weekNumber(
70 this: Allocated<Self>,
71 day_of_the_week: EKWeekday,
72 week_number: NSInteger,
73 ) -> Retained<Self>;
74
75 #[cfg(feature = "EKTypes")]
76 /// The day of the week.
77 #[unsafe(method(dayOfTheWeek))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn dayOfTheWeek(&self) -> EKWeekday;
80
81 /// The week number.
82 #[unsafe(method(weekNumber))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn weekNumber(&self) -> NSInteger;
85 );
86}
87
88/// Methods declared on superclass `NSObject`.
89impl EKRecurrenceDayOfWeek {
90 extern_methods!(
91 #[unsafe(method(init))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95 #[unsafe(method(new))]
96 #[unsafe(method_family = new)]
97 pub unsafe fn new() -> Retained<Self>;
98 );
99}