fix(ios): Objective-C class name "UITabBar..." already in use handling

This commit is contained in:
Nathan Walker
2020-09-07 10:50:24 -07:00
parent 5e4cd9865a
commit c8273931f3
3 changed files with 157 additions and 143 deletions

View File

@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "6.5.17",
"version": "6.5.18",
"homepage": "https://www.nativescript.org",
"repository": {
"type": "git",

View File

@ -18,12 +18,18 @@ export * from "./tab-view-common";
const majorVersion = iosUtils.MajorVersion;
const isPhone = device.deviceType === "Phone";
class UITabBarControllerImpl extends UITabBarController {
let UITabBarControllerImpl;
let UITabBarControllerDelegateImpl;
let UINavigationControllerDelegateImpl;
const setupControllers = function () {
if (typeof UITabBarControllerImpl === 'undefined') {
class UITabBarControllerClass extends UITabBarController {
private _owner: WeakRef<TabView>;
public static initWithOwner(owner: WeakRef<TabView>): UITabBarControllerImpl {
let handler = <UITabBarControllerImpl>UITabBarControllerImpl.new();
public static initWithOwner(owner: WeakRef<TabView>): typeof UITabBarControllerImpl {
let handler = <typeof UITabBarControllerImpl>UITabBarControllerImpl.new();
handler._owner = owner;
return handler;
@ -84,15 +90,16 @@ class UITabBarControllerImpl extends UITabBarController {
}
}
}
}
}
UITabBarControllerImpl = UITabBarControllerClass;
class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControllerDelegate {
class UITabBarControllerDelegateClass extends NSObject implements UITabBarControllerDelegate {
public static ObjCProtocols = [UITabBarControllerDelegate];
private _owner: WeakRef<TabView>;
public static initWithOwner(owner: WeakRef<TabView>): UITabBarControllerDelegateImpl {
let delegate = <UITabBarControllerDelegateImpl>UITabBarControllerDelegateImpl.new();
public static initWithOwner(owner: WeakRef<TabView>): typeof UITabBarControllerDelegateImpl {
let delegate = <typeof UITabBarControllerDelegateImpl>UITabBarControllerDelegateImpl.new();
delegate._owner = owner;
return delegate;
@ -131,15 +138,16 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
(<any>tabBarController)._willSelectViewController = undefined;
}
}
}
UITabBarControllerDelegateImpl = UITabBarControllerDelegateClass;
class UINavigationControllerDelegateImpl extends NSObject implements UINavigationControllerDelegate {
class UINavigationControllerDelegateClass extends NSObject implements UINavigationControllerDelegate {
public static ObjCProtocols = [UINavigationControllerDelegate];
private _owner: WeakRef<TabView>;
public static initWithOwner(owner: WeakRef<TabView>): UINavigationControllerDelegateImpl {
let delegate = <UINavigationControllerDelegateImpl>UINavigationControllerDelegateImpl.new();
public static initWithOwner(owner: WeakRef<TabView>): typeof UINavigationControllerDelegateImpl {
let delegate = <typeof UINavigationControllerDelegateImpl>UINavigationControllerDelegateImpl.new();
delegate._owner = owner;
return delegate;
@ -170,7 +178,13 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
owner._onViewControllerShown(viewController);
}
}
}
}
UINavigationControllerDelegateImpl = UINavigationControllerDelegateClass;
}
};
setupControllers();
function updateTitleAndIconPositions(tabItem: TabViewItem, tabBarItem: UITabBarItem, controller: UIViewController) {
if (!tabItem || !tabBarItem) {
@ -256,11 +270,11 @@ export class TabViewItem extends TabViewItemBase {
}
export class TabView extends TabViewBase {
public viewController: UITabBarControllerImpl;
public viewController: typeof UITabBarControllerImpl;
public items: TabViewItem[];
public _ios: UITabBarControllerImpl;
private _delegate: UITabBarControllerDelegateImpl;
private _moreNavigationControllerDelegate: UINavigationControllerDelegateImpl;
public _ios: typeof UITabBarControllerImpl;
private _delegate: typeof UITabBarControllerDelegateImpl;
private _moreNavigationControllerDelegate: typeof UINavigationControllerDelegateImpl;
private _iconsCache = {};
constructor() {

View File

@ -3,7 +3,7 @@
"main": "index",
"types": "index.d.ts",
"description": "NativeScript Core Modules",
"version": "6.5.17",
"version": "6.5.18",
"homepage": "https://www.nativescript.org",
"repository": {
"type": "git",
@ -11,7 +11,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@nativescript/core": "6.5.17"
"@nativescript/core": "6.5.18"
},
"devDependencies": {
"tns-platform-declarations": "6.5.15"