[SWIFT] I made a library that works like a Safari tab !!

Implementation image

code

Podfile


pod 'TDTabView'

ViewController


class ViewController: TDTabViewController {
    
    var vc1: UIViewController!
    var vc2: UIViewController!
    var vc3: UIViewController!

    override func viewDidLoad() {
        super.viewDidLoad()
        self.delegate = self
        
        let storyboard1 = UIStoryboard(name: "Table", bundle: nil)
        vc1 = storyboard1.instantiateInitialViewController()
        
        let storyboard2 = UIStoryboard(name: "Image", bundle: nil)
        vc2 = storyboard2.instantiateInitialViewController()
        
        let storyboard3 = UIStoryboard(name: "Web", bundle: nil)
        vc3 = storyboard3.instantiateInitialViewController()
    }
}

extension ViewController: TDTabViewControllerDelegate {
    func viewControllers() -> [UIViewController] {
        return [vc1, vc2, vc3]
    }
    
    func backgroundColor() -> UIColor? {
        return UIColor(red: 50/255, green: 50/255, blue: 50/255, alpha: 0.8)
    }
}

point

class ViewController: TDTabViewController {

Create a view controller that inherits from TDTabViewController.


extension ViewController: TDTabViewControllerDelegate {
    func viewControllers() -> [UIViewController] {
        return [vc1, vc2, vc3]
    }
    
    func backgroundColor() -> UIColor? {
        return UIColor(red: 50/255, green: 50/255, blue: 50/255, alpha: 0.8)
    }
}

Just add TDTabViewControllerDelegate and return the view controller you want to display as a tab! Very easy!

Impressions of making your own library

The main function was completed in one day, but I was not satisfied with the UI (although I still want to improve it), and it took about two weeks to improve the UI. .. ..

Please use it if you like! And please give me LGTM (* ยด-`)

Click here for git https://github.com/ymarui/TDTabView

end

Recommended Posts

I made a library that works like a Safari tab !!
I made a viewer app that displays a PDF
I made a Ruby extension library in C
I made a library for displaying tutorials on Android.
I made a Wrapper that calls KNP from Java
I made a mod that instantly calls a vehicle with Minecraft
Ruby: I made a FizzBuzz program!
I made a shopify app @java
I made a GUI with Swing
I wrote a Stalin sort that feels like a mess in Java
I made a source that automatically generates JPA Entity class files
I made a question that can be used for a technical interview
I made a simple recommendation function.
I made a matching app (Android app)
I made a package.xml generation tool.
[Android] I made a pedometer app.
I made a class that can use JUMAN and KNP from Java
I made a class that automatically generates Json that specifies Minecraft texture etc. [1.12.2]
I made a site that summarizes information on carbohydrate restriction with Vue.js
[Ruby] I made a simple Ping client
I made a risky die with Ruby
I made a plugin for IntelliJ IDEA
I made a rock-paper-scissors app with kotlin
I made a calculator app on Android
I made a new Java deployment tool
I made a rock-paper-scissors app with android
I made a bulletin board using Docker 1
I made a THETA API client that can be used for plug-in development
I made a simple graph library for smartphone apps [MP Android Chart Kai]
I made a primality test program in Java
04. I made a front end with SpringBoot + Thymeleaf
I made a mosaic art with Pokemon images
I made a gender selection column with enum
I made a rock-paper-scissors game in Java (CLI)
I made a Docker container to run Maven
[Rails] I made a draft function using enum
I made a LINE bot with Rails + heroku
A collection of RSpecs that I used frequently
I made a portfolio with Ruby On Rails