Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sefira enhancements #135

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions KosherCocoa.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@
46DB49631D9839F100F3A576 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = HK64RUWW3P;
LastSwiftMigration = 0900;
LastSwiftMigration = 0920;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -1721,7 +1721,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
Expand All @@ -1748,7 +1748,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.mosheberman.KosherCocoaTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
Expand Down
35 changes: 29 additions & 6 deletions KosherCocoa/Library/Core/Calendar/Sefira/KCSefiraFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,40 @@ NS_SWIFT_NAME(SefiraFormatter)

- (nullable NSString *)countStringFromInteger:(NSInteger)integer withPrayers:(KCSefiraPrayerAddition)prayers;

#pragma mark - Getting the Kabbalistic Trait of the Week

/**
Converts an integer (between 1 and 7, inclusive)
into a kabbalistic trait traditionally assigned
to a given week of the omer.

@param week The week to get the trait for.
@return A string containing the attribure of that week.
*/
- (nullable NSString *)kabbalisticTraitForWeek:(NSInteger)week;


#pragma mark - Getting the Kabbalistic Trait of the Day

/**
* Converts an integer (between 1 and 49, inclusive)
* into a kabbalistic trait traditionally assigned
* to a given day of the omer.
*
* @return A string containing the attribure of that day.
Converts an integer (between 1 and 49, inclusive)
into a kabbalistic trait traditionally assigned
to a given day of the omer.

@param day The day to get the trait for.
@return A string containing the attribure of that day.
*/
- (nullable NSString *)kabbalisticTraitForDay:(NSInteger)day;

- (nullable NSString *)kabbalisticTraitFromInteger:(NSInteger)integer;
/**
Converts an integer (between 1 and 49, inclusive)
into a kabbalistic trait traditionally assigned
to a given day of the omer.

@param integer The day to get the trait for.
@return A string containing the attribure of that day.
*/
- (nullable NSString *)kabbalisticTraitFromInteger:(NSInteger)integer DEPRECATED_MSG_ATTRIBUTE("Use kabbalisticTraitForDay: and kabbalisticTraitForWeek: instead.");

/**
* Get the blessing text for counting the omer.
Expand Down
129 changes: 67 additions & 62 deletions KosherCocoa/Library/Core/Calendar/Sefira/KCSefiraFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ @interface KCSefiraFormatter ()
@property (nonatomic, strong) NSArray <NSString *> *englishKabbalisticStrings;
@property (nonatomic, strong) NSArray <NSString *> *hebrewKabbalisticStrings;
@property (nonatomic, strong) NSArray <NSString *> *transliteratedHebrewKabbalisticStrings;
@property (nonatomic, strong) NSArray <NSString *> *sefirahNamesByWeek;

@end

Expand Down Expand Up @@ -259,57 +260,30 @@ - (nonnull id)init
_sefardTransliteratedStrings = @[];
_sephardicTransliteratedStrings = @[];

_hebrewKabbalisticStrings = @[
@"חֶסֶד שֶבְּחֶסֶד",
@"גְבוּרָה שֶבְּחֶסֶד",
@"תִּפֶארֶת שֶבְּחֶסֶד",
@"נֶצַח שֶבְּחֶסֶד",
@"הוֹד שֶבְּחֶסֶד",
@"יְסֹוד שֶבְּחֶסֶד",
@"מַלְכוּת שֶבְּחֶסֶד",
@"חֶסֶד שֶבְּגְבוּרָה",
@"גְבוּרָה שֶבְּגְבוּרָה",
@"תִּפֶארֶת שֶבְּגְבוּרָה",
@"נֶצַח שֶבְּגְבוּרָה",
@"הוֹד שֶבְּגְבוּרָה",
@"יְסֹוד שֶבְּגְבוּרָה",
@"מַלְכוּת שֶבְּגְבוּרָה",
@"חֶסֶד שֶבְּתִּפֶארֶת",
@"גְבוּרָה שֶבְּתִּפֶארֶת",
@"תִּפֶארֶת שֶבְּתִּפֶארֶת",
@"נֶצַח שֶבְּתִּפֶארֶת",
@"הוֹד שֶבְּתִּפֶארֶת",
@"יְסֹוד שֶבְּתִּפֶארֶת",
@"מַלְכוּת שֶבְּתִּפֶארֶת",
@"חֶסֶד שֶבְּנֶצַח",
@"גְבוּרָה שֶבְּנֶצַח",
@"תִּפֶארֶת שֶבְּנֶצַח",
@"נֶצַח שֶבְּנֶצַח",
@"הוֹד שֶבְּנֶצַח",
@"יְסֹוד שֶבְּנֶצַח",
@"מַלְכוּת שֶבְּנֶצַח"
, @"חֶסֶד שֶבְּהוֹד",
@"גְבוּרָה שֶבְּהוֹד",
@"תִּפֶארֶת שֶבְּהוֹד",
@"נֶצַח שֶבְּהוֹד",
@"הוֹד שֶבְּהוֹד",
@"יְסֹוד שֶבְּהוֹד",
@"מַלְכוּת שֶבְּהוֹד",
@"חֶסֶד שֶבְּיְסֹוד",
@"גְבוּרָה שֶבְּיְסֹוד",
@"תִּפֶארֶת שֶבְּיְסֹוד",
@"נֶצַח שֶבְּיְסֹוד",
@"הוֹד שֶבְּיְסֹוד",
@"יְסֹוד שֶבְּיְסֹוד",
@"מַלְכוּת שֶבְּיְסֹוד",
@"חֶסֶד שֶבְּמַלְכוּת",
@"גְבוּרָה שֶבְּמַלְכוּת",
@"תִּפֶארֶת שֶבְּמַלְכוּת",
@"נֶצַח שֶבְּמַלְכוּת",
@"הוֹד שֶבְּמַלְכוּת",
@"יְסֹוד שֶבְּמַלְכוּת",
@"מַלְכוּת שֶבְּמַלְכוּת"
];
_sefirahNamesByWeek = @[
@"חֶסֶד",
@"גְבוּרָה",
@"תִּפֶארֶת",
@"נֶצַח",
@"הוֹד",
@"יְסֹוד",
@"מַלְכוּת"
];
NSMutableArray <NSString *>* hebrewKabbalisticStrings = [@[] mutableCopy];

for (NSInteger i = 0; i<_sefirahNamesByWeek.count; i++) {
for (NSInteger j = 0; j<_sefirahNamesByWeek.count; j++) {
NSString *part1 = _sefirahNamesByWeek[j];
NSString *part2 = @"שֶבְּ";
NSString *part3 = _sefirahNamesByWeek[i];

NSString *trait = [NSString stringWithFormat:@"%@ %@%@", part1, part2, part3];
[hebrewKabbalisticStrings addObject:trait];
}
}

_hebrewKabbalisticStrings = hebrewKabbalisticStrings;

_englishKabbalisticStrings = @[];
_transliteratedHebrewKabbalisticStrings = @[];
}
Expand Down Expand Up @@ -460,7 +434,7 @@ - (nullable NSString *)countStringFromInteger:(NSInteger)integer withPrayers:(en
if (showRibono)
{

NSString *trait = [self kabbalisticTraitFromInteger:integer];
NSString *trait = [self kabbalisticTraitForDay:integer];

ribono = [NSString stringWithFormat:@"רִבּוֹנוֹ שֶׁל עוֹלָם, אַתָּה צִוִּיתָֽנוּ עַל יְדֵי מֹשֶׁה עַבְדֶּֽךָ לִסְפּוֹר סְפִירַת הָעֹֽמֶר, כְּדֵי לְטַהֲרֵֽנוּ מִקְּלִפּוֹתֵֽינוּ וּמִטֻּמְאוֹתֵֽינוּ, כְּמוֹ שֶׁכָּתַֽבְתָּ בְּתוֹרָתֶֽךָ: וּסְפַרְתֶּם לָכֶם מִמָּחֳרַת הַשַּׁבָּת מִיּוֹם הֲבִיאֲכֶם אֶת עֹֽמֶר הַתְּנוּפָה, שֶֽׁבַע שַׁבָּתוֹת תְּמִימֹת תִּהְיֶֽינָה, עַד מִמָּחֳרַת הַשַּׁבָּת הַשְּׁבִיעִת תִּסְפְּרוּ חֲמִשִּׁים יוֹם, כְּדֵי שֶׁיִּטָּהֲרוּ נַפְשׁוֹת עַמְּךָ יִשְׂרָאֵל מִזֻּהֲמָתָם. וּבְכֵן יְהִי רָצוֹן מִלְּפָנֶֽיךָ יְיָ אֱלֹהֵֽינוּ וֵאלֹהֵי אֲבוֹתֵֽינוּ, שֶׁבִּזְכוּת סְפִירַת הָעֹֽמֶר שֶׁסָּפַֽרְתִּי הַיּוֹם, יְתֻקַּן מַה שֶּׁפָּגַֽמְתִּי בִּסְפִירָה %@ וְאֶטָּהֵר וְאֶתְקַדֵּשׁ בִּקְדֻשָּׁה שֶׁל מַֽעְלָה, וְעַל יְדֵי זֶה יֻשְׁפַּע שֶֽׁפַע רַב בְּכָל הָעוֹלָמוֹת, וּלְתַקֵּן אֶת נַפְשׁוֹתֵֽינוּ וְרוּחוֹתֵֽינוּ וְנִשְׁמוֹתֵֽינוּ מִכָּל סִיג וּפְגַם, וּלְטַהֲרֵֽנוּ וּלְקַדְּשֵֽׁנוּ בִּקְדֻשָּׁתְךָ הָעֶלְיוֹנָה, אָמֵן סֶֽלָה.", trait];

Expand All @@ -481,30 +455,61 @@ - (nullable NSString *)countStringFromInteger:(NSInteger)integer withPrayers:(en
return output;
}

#pragma mark - Getting the Kabbalistic Trait of the Day
#pragma mark - Getting the Kabbalistic Trait of the Week

/**
* Converts an integer (between 1 and 49, inclusive)
* into a kabbalistic trait traditionally assigned
* to a given day of the omer.
*
* @return A string containing the attribure of that day.
Converts an integer (between 1 and 7, inclusive)
into a kabbalistic trait traditionally assigned
to a given week of the omer.

@param week The week to get the trait for.
@return A string containing the attribure of that week.
*/
- (nullable NSString *)kabbalisticTraitForWeek:(NSInteger)week;
{
if (week > 7 || week < 1) {
return nil;
}
return self.sefirahNamesByWeek[week - 1];
}

- (nullable NSString *)kabbalisticTraitFromInteger:(NSInteger)integer
#pragma mark - Getting the Kabbalistic Trait of the Day

/**
Converts an integer (between 1 and 49, inclusive)
into a kabbalistic trait traditionally assigned
to a given day of the omer.

@param day The day to get the trait for.
@return A string containing the attribure of that day.
*/
- (nullable NSString *)kabbalisticTraitForDay:(NSInteger)day;
{
NSString *trait = nil;

integer = integer - 1;
day = day - 1;

if (integer < self.hebrewKabbalisticStrings.count)
if (day < self.hebrewKabbalisticStrings.count)
{
trait = self.hebrewKabbalisticStrings[integer];
trait = self.hebrewKabbalisticStrings[day];
}

return trait;
}

/**
* Converts an integer (between 1 and 49, inclusive)
* into a kabbalistic trait traditionally assigned
* to a given day of the omer.
*
* @return A string containing the attribure of that day.
*/

- (nullable NSString *)kabbalisticTraitFromInteger:(NSInteger)integer
{
return [self kabbalisticTraitForDay:integer];
}

#pragma mark - Helpers

/**
Expand Down