First of all, I decided to make my project with only UIKit.
So I deleted 'Main' storyboard, Info.plist->Storyboard name, and Main storyboard file base name->Main. And I edited SceneDelegate.
So now I can display the single viewControllers, but when I try to set 'UITabBarController' to rootViewController, It cause this error(title).
I tried to make UITabBarController in ViewController, UITabBarController in SceneDelegate and some more.
// BackgroundViewController for the rootViewController
import UIKit
class BackgroundViewController: UIViewController {
let backgroundTabBarController = UITabBarController()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
createTabBar()
}
}
extension BackgroundViewController {
private func createTabBar() {
view.backgroundColor = .white
view.addSubview(backgroundTabBarController.view)
let firstViewController = BookSearchViewController()
let secondViewController = MainViewController()
let thirdViewController = UserStatusViewController()
let lastViewController = OrderViewController()
firstViewController.tabBarItem = UITabBarItem(title: "Search", image: UIImage(systemName: "magnifyingglass.circle.fill"), selectedImage: UIImage(systemName: "magnifyingglass.circle"))
secondViewController.tabBarItem = UITabBarItem(title: "Main", image: UIImage(systemName: "house.fill"), selectedImage: UIImage(systemName: "house"))
thirdViewController.tabBarItem = UITabBarItem(title: "My", image: UIImage(systemName: "person.fill"), selectedImage: UIImage(systemName: "person"))
lastViewController.tabBarItem = UITabBarItem(title: "Order", image: UIImage(systemName: "menucard.fill"), selectedImage: UIImage(systemName: "menucard"))
backgroundTabBarController.viewControllers = [firstViewController, secondViewController, thirdViewController, lastViewController]
backgroundTabBarController.selectedViewController = secondViewController
}
}
// SceneDelegate
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.rootViewController = BackgroundViewController()
window?.makeKeyAndVisible()
}
}
// Error code
Thread 1: "Could not find a storyboard named 'Main' in bundle NSBundle </Users/[MyDesktopName]/Library/Developer/CoreSimulator/Devices/[ApplicationName]/data/Containers/Bundle/Application/[ApplicationName]/BTY.app> (loaded)"
But anyone of this solve the problem.
How can I make UITabBarController to rootViewController?
Make UITabBarController in SceneDelegate
Make new UIViewController that have UITabBarController and set to rootViewController
Set ViewControllers with 'UINavigationController(rootViewController:)'
Present UITabBarController from other viewController
Post
Replies
Boosts
Views
Activity
First of all, I decided to make my project with only UIKit.
So I deleted 'Main' storyboard, Info.plist->Storyboard name, and Main storyboard file base name->Main.
And I edited SceneDelegate.
So now I can display the single viewControllers, but when I try to set 'UITabBarController' to rootViewController, It cause this error(title).
I tried to make UITabBarController in ViewController, UITabBarController in SceneDelegate and some more.
How can I fix this? We can't use code-based UITabBarController in new version of Xcode now?
Professor said I can get RAW data from apple watch, but he didn't know specific data what we can collect.
Can I get RAW data from apple watch? and which datas can I get?
I want to measure current battery consumption and show it in the view.
While using HealthKit, I wanted to collect sleep analysis with the measuring device model data.
But I couldn't get model string in any way.
sleepSample.device
sleepSample.device.self
sleepSample.device?.model
sleepSample.device?.name
All things were contain 'nil'.
How can I get model data in HKCategoryType?
p.s. I can get model data in HKSampleType like stepCount, activeEnergyBurned, distanceWalkingRunning