I know bit of ts and I am new to Objective C.
I have a meeting param which I want to extend in meeting obj (MeetingConfig.h) file
@interface MeetingParams : NSObject
@property (nonatomic, assign) NSString* roomName;
@property (nonatomic, assign) NSString* authToken;
@property (nonatomic, assign)Boolean autoTune;
@property (nonatomic, assign)NSString* apiBase;
@property (nonatomic, assign)Boolean showSetupScreen;
@end
@interface MeetingConfig : NSObject
@property (nonatomic, assign) NSString* roomName;
@property (nonatomic, assign) NSString* authToken;
@property (nonatomic, assign)Boolean autoTune;
@property (nonatomic, assign)NSString* apiBase;
@property (nonatomic, assign)Boolean showSetupScreen;
- (void) setAuthToken:(NSString *)authToken;
- (void) setApiBase:(NSString *)apiBase;
- (void) setShowSetupScreen:(Boolean)showSetupScreen;
- (void) setAutoTuneEnabled:(Boolean)autoTune;
- (id) init;
@end
How can I do that? (right now I know there is redundant code)
Also, I know I am mixing language but can someone tell me what would be the equivalence of this code from Java in objective C?
MeetingConfig config = new MeetingConfig();
config.setRoomName("abc");
For now, I have made this as MeetingConfig.m
file
#import "MeetingConfig.h"
@implementation MeetingConfig
- (id) init
{
if (self = [super init]) {
self.apiBase = @"https://api.xyz.in";
self.showSetupScreen = false;
self.autoTune = true;
}
return self;
}
- (void) setAuthToken:(NSString *)authToken
{
self.authToken = authToken;
}
- (void) setApiBase:(NSString *)apiBase
{
self.apiBase = apiBase;
}
- (void) setShowSetupScreen:(Boolean)showSetupScreen
{
self.showSetupScreen = showSetupScreen;
}
- (void) setAutoTuneEnabled:(Boolean)autoTune
{
self.autoTune = autoTune;
}
@end
Which I am hoping is equivalent to my this file
package com.dyteclientmobile;
public class MeetingConfig {
public String roomName;
public String authToken;
public boolean autoTune;
public String apiBase;
public boolean showSetupScreen;
public MeetingConfig() {
this.apiBase = "https://api.xyz.in";
this.showSetupScreen = false;
this.autoTune = true;
}
public MeetingConfig setRoomName(String roomName) {
this.roomName = roomName;
return this;
}
public MeetingConfig setAuthToken(String authToken) {
this.roomName = roomName;
return this;
}
public MeetingConfig setApiBase(String apiBase) {
this.apiBase = apiBase;
return this;
}
public MeetingConfig setShowSetupScreen(boolean showSetupScreen) {
this.showSetupScreen = showSetupScreen;
return this;
}
public MeetingConfig setAutoTuneEnabled(boolean autoTune) {
this.autoTune = autoTune;
return this;
}
}