コードをswift xcodeからc#(xamarin)に変換しようとしています。xcodeのコード例を理解できません
#pragma mark - Implement DTBackgroundView Class
@interface DTBackgroundView : UIView
{
UIWindow *_previousKeyWindow;
UIWindow *_alertWindow;
NSMutableArray *_alertViews;
}
+ (Instancetype)currentBackground;
static DTBackgroundView *singletion = nil;
@implementation DTBackgroundView
+ (Instancetype)currentBackground
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
singletion = [DTBackgroundView new];
});
return singletion;
}
私の質問は次のとおりです:
がをcurrentBackgroundている人である私は、次のコードを理解していませんか?
次のコードでbackgroundView何をされていますAdeelは彼のコメントで言うように、それはObjective-Cのコードではなく、スウィフト
DTBackgroundView *backgroundView = [DTBackgroundView currentBackground];
__singleton__クラスのアイデアを得るには、__designPatterns__の本を参照する必要があります。あなたが投稿したコードは、その__Objective-C__を__Swift__していません。 – Adeel