How to deal with Properties in Protocols and Getter and Setter of those properties in objective c
<p>I have the following protocol:</p>

<pre><code>@protocol CardTransferFundsDelegate &lt;NSObject&gt;
@property (strong, nonatomic) id&lt;CardTransferFundsView&gt; view;
@end
</code></pre>

<p>I have the following in the .h file:</p>

<pre><code>@interface CardTopViewModel : NSObject&lt;CardTransferFundsDelegate&gt;
- (instancetype)initWithVirtualCard:(Card *)card;
@end
</code></pre>

<p>In my .m I have the following:</p>

<pre><code>@interface CardTopUpViewModel()
@property (strong, nonatomic) Card *card;
@end

@implementation CardTopUpViewModel

-(instancetype)initWithCard:(Card *)card {
    self = [super init];
    if(self){
        self.card = card;
    }
    return self;
}

- (id &lt;CardTransferFundsView&gt;)view {
    return nil;
}

- (void)setView:(id &lt;CardTransferFundsView&gt;)view {
    self.view = view;
}

@end
</code></pre>

<p>The issue I have is whenever I call <code>setView</code> it then calls <code>self.view</code> which then calls the getter method and I have a program that just keeps running infinitely. </p>

<p>So my question is, How do I fix this issue, such that the protocol still keeps the property but I am able to get and set the view without having the program run infinitely? </p>