//
//  NSBundle+DDCategory.m
//  DDCategoryKit_Private
//  Created by DDIsFriend on 2022/7/29.

#import "NSBundle+DDCategory.h"

@implementation NSBundle (DDCategory)
- (nullable NSBundle *)bundleWithName:(NSString *)bundleName aClass:(Class)aClass{
    NSString *bundlePath = [[NSBundle bundleForClass:aClass].resourcePath stringByAppendingPathComponent:bundleName];
    
    NSString *bundleType = @".bundle";
    if (![bundlePath hasSuffix:bundleType]) {
        bundlePath = [bundlePath stringByAppendingString:bundleType];
    }
    
    NSBundle *sourceBundle = [NSBundle bundleWithPath:bundlePath];
    return sourceBundle;
}
@end
