[ios] WIP: Switching main/map buttons to SwiftUI

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-08-06 16:01:57 +02:00
parent c21afb27bd
commit bff4b2348a
39 changed files with 791 additions and 570 deletions

View File

@@ -3,7 +3,6 @@
#import "MWMNavigationDashboardManager.h"
@class MapViewController;
@class BottomTabBarViewController;
@class TrackRecordingButtonViewController;
@class SearchQuery;
@@ -26,7 +25,7 @@ typedef NS_ENUM(NSUInteger, TrackRecordingButtonState) {
@property(nonatomic) MWMBottomMenuState menuState;
@property(nonatomic) MWMBottomMenuState menuRestoreState;
@property(nonatomic) BOOL isDirectionViewHidden;
@property(nonatomic) BottomTabBarViewController * tabBarController;
@property(nonatomic) UIViewController * tabBarController;
@property(nonatomic) TrackRecordingButtonViewController * trackRecordingButton;
- (instancetype)init __attribute__((unavailable("init is not available")));

View File

@@ -64,6 +64,9 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
self.menuRestoreState = MWMBottomMenuStateInactive;
self.isAddingPlace = NO;
self.searchManager = controller.searchManager;
[self tabBarController];
return self;
}
@@ -220,13 +223,20 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
return _trafficButton;
}
- (BottomTabBarViewController *)tabBarController {
- (UIViewController *)tabBarController {
if (!_tabBarController) {
MapViewController * ownerController = _ownerController;
_tabBarController = [BottomTabBarBuilder buildWithMapViewController:ownerController controlsManager:self];
_tabBarController = [BridgeControllers mapControls];
[ownerController addChildViewController:_tabBarController];
UIView * tabBarViewSuperView = ownerController.controlsView;
[tabBarViewSuperView addSubview:_tabBarController.view];
_tabBarController.view.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[tabBarViewSuperView.topAnchor constraintEqualToAnchor:_tabBarController.view.topAnchor],
[tabBarViewSuperView.leadingAnchor constraintEqualToAnchor:_tabBarController.view.leadingAnchor],
[tabBarViewSuperView.bottomAnchor constraintEqualToAnchor:_tabBarController.view.bottomAnchor],
[tabBarViewSuperView.trailingAnchor constraintEqualToAnchor:_tabBarController.view.trailingAnchor]
]];
}
return _tabBarController;
@@ -289,7 +299,7 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
MapViewController * ownerController = _ownerController;
switch (_menuState) {
case MWMBottomMenuStateActive:
_tabBarController.isHidden = NO;
_tabBarController.view.hidden = NO;
if (_menuController == nil) {
_menuController = [BottomMenuBuilder buildMenuWithMapViewController:ownerController
controlsManager:self
@@ -298,7 +308,7 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
}
break;
case MWMBottomMenuStateLayers:
_tabBarController.isHidden = NO;
_tabBarController.view.hidden = NO;
if (_menuController == nil) {
_menuController = [BottomMenuBuilder buildLayersWithMapViewController:ownerController
controlsManager:self
@@ -307,14 +317,14 @@ NSString *const kMapToCategorySelectorSegue = @"MapToCategorySelectorSegue";
}
break;
case MWMBottomMenuStateInactive:
_tabBarController.isHidden = NO;
_tabBarController.view.hidden = NO;
if (_menuController != nil) {
[_menuController dismissViewControllerAnimated:YES completion:nil];
_menuController = nil;
}
break;
case MWMBottomMenuStateHidden:
_tabBarController.isHidden = YES;
_tabBarController.view.hidden = YES;
if (_menuController != nil) {
[_menuController dismissViewControllerAnimated:YES completion:nil];
_menuController = nil;

View File

@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -18,12 +16,12 @@
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WVx-0E-RoH" customClass="MWMButton" propertyAccessControl="all">
<rect key="frame" x="0.0" y="0.0" width="56" height="56"/>
<viewLayoutGuide key="safeArea" id="iUc-A7-STp"/>
<accessibility key="accessibilityConfiguration" identifier="layers_button"/>
<constraints>
<constraint firstAttribute="height" constant="56" id="24f-V4-Vuf"/>
<constraint firstAttribute="width" constant="56" id="hko-xz-hRz"/>
</constraints>
<viewLayoutGuide key="safeArea" id="iUc-A7-STp"/>
<state key="normal" image="btn_traffic_on_light"/>
<connections>
<action selector="buttonTouchUpInside" destination="-1" eventType="touchUpInside" id="fKZ-g8-4ML"/>