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
36extern_conformance!(
37 unsafe impl NSCoding for EKRecurrenceDayOfWeek {}
38);
39
40extern_conformance!(
41 unsafe impl NSCopying for EKRecurrenceDayOfWeek {}
42);
43
44unsafe impl CopyingHelper for EKRecurrenceDayOfWeek {
45 type Result = Self;
46}
47
48extern_conformance!(
49 unsafe impl NSObjectProtocol for EKRecurrenceDayOfWeek {}
50);
51
52extern_conformance!(
53 unsafe impl NSSecureCoding for EKRecurrenceDayOfWeek {}
54);
55
56impl EKRecurrenceDayOfWeek {
57 extern_methods!(
58 #[cfg(feature = "EKTypes")]
59 /// Creates an autoreleased object with a day of the week and week number of zero.
60 #[unsafe(method(dayOfWeek:))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn dayOfWeek(day_of_the_week: EKWeekday) -> Retained<Self>;
63
64 #[cfg(feature = "EKTypes")]
65 /// Creates an autoreleased object with a specific day of week and week number.
66 #[unsafe(method(dayOfWeek:weekNumber:))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn dayOfWeek_weekNumber(
69 day_of_the_week: EKWeekday,
70 week_number: NSInteger,
71 ) -> Retained<Self>;
72
73 #[cfg(feature = "EKTypes")]
74 /// Creates an day-of-week object with a specific day of week and week number.
75 #[unsafe(method(initWithDayOfTheWeek:weekNumber:))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn initWithDayOfTheWeek_weekNumber(
78 this: Allocated<Self>,
79 day_of_the_week: EKWeekday,
80 week_number: NSInteger,
81 ) -> Retained<Self>;
82
83 #[cfg(feature = "EKTypes")]
84 /// The day of the week.
85 #[unsafe(method(dayOfTheWeek))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn dayOfTheWeek(&self) -> EKWeekday;
88
89 /// The week number.
90 #[unsafe(method(weekNumber))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn weekNumber(&self) -> NSInteger;
93 );
94}
95
96/// Methods declared on superclass `NSObject`.
97impl EKRecurrenceDayOfWeek {
98 extern_methods!(
99 #[unsafe(method(init))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
102
103 #[unsafe(method(new))]
104 #[unsafe(method_family = new)]
105 pub unsafe fn new() -> Retained<Self>;
106 );
107}