Skip to content

iOS development UIKit & SwiftUI templates with install script

License

Notifications You must be signed in to change notification settings

meyusufdemirci/Templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The cool / useful templates that can be used in iOS development

Usage

  • Run the Install script, the templates will be imported into Xcode
  • When you try to add New File, you will see the templates under the My Templates section

Templates

UIKit MVVM Protocol Oriented Controller

Controller

class MyTemplatesController: UIViewController {

    // MARK: Properties
    
    private let viewModel: MyTemplatesViewModel

    init(viewModel: MyTemplatesViewModel = .init()) {
        self.viewModel = viewModel

        super.init(nibName: nil, bundle: nil)

        viewModel.output = self
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        viewModel.input?.viewDidLoad()
    }
}

// MARK: - MyTemplatesOutput

extension MyTemplatesController: MyTemplatesOutput {

    func refresh() {
        // Refresh data or UI
    }
}

View Model

class MyTemplatesViewModel {

    weak var input: MyTemplatesInput?
    weak var output: MyTemplatesOutput?

    init() {
        input = self
    }
}

// MARK: - MyTemplatesInput

extension MyTemplatesViewModel: MyTemplatesInput {

    func viewDidLoad() {
        // Run some logic

        output?.refresh()
    }
}

Protocols

protocol MyTemplatesInput: AnyObject {
    func viewDidLoad()
}

protocol MyTemplatesOutput: AnyObject {
    func refresh()
}

About

iOS development UIKit & SwiftUI templates with install script

Topics

Resources

License

Stars

Watchers

Forks