CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

MTSDK 4.0.8

MTSDK 4.0.8

Maintained by MTSDK.



MTSDK 4.0.8

  • By
  • Minh Tường

MTSDK

Version License Platform

About

This CocoaPods library is software development kit for iOS, the project depends on 'SnapKit', '~> 5.0.0'

Installation with CocoaPods

To integrate MTSDK into your Xcode project using CocoaPods, specify it in your Podfile:

target 'MyApp' do
  pod 'MTSDK', '~> 4.0'
end

Example code:

The code would look like this:

import MTSDK

//Add button to view
let helloButton = UIButton()
helloButton >>> view >>> {  //Add button to view then return this button in block
    $0.snp.makeConstraints {
        $0.top.equalTo(topSafe).offset(16)
        $0.centerX.equalToSuperview()
        $0.height.equalTo(39)
        $0.width.equalTo(343)
    }
    $0.setTitle("Hello", for: .normal)
    $0.setTitleColor(.link, for: .normal)
    $0.setImage(UIImage(named: imageName), for: .normal)
    $0.handle {
        print("button tapped!")
    }
}

TextField with custom style:

import MTSDK

let userNameTextField = TTextField()
userNameTextField >>> view >>> {
    $0.snp.makeConstraints {
        $0.top.equalTo(helloButton.snp.bottom).offset(32)
        $0.leading.equalToSuperview().offset(16)
        $0.trailing.equalToSuperview().offset(-16)
        $0.height.equalTo(50)
    }
    $0.placeholder = "Enter Username"
    $0.editingChangedHandle {
        let text = userNameTextField.text ?? ""
        print(text)
    }
    $0.editingDidEndHandle {
        guard let username = userNameTextField.text else {return}
        print("username: \(username)")
    }
}

CollectionView and TableView like this:

import MTSDK

//MARK: - Add to view 
collectionView >>> view >>> {
    $0.snp.makeConstraints {
        $0.edges.equalToSuperview()
    }
    $0.backgroundColor = UIColor.from("0268FF")
    $0.registerReusedCell(AnyCollectionViewCell.self)
    $0.delegate = self
    $0.dataSource = self
}

//MARK: - In Cell
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusable(cellClass: AnyCollectionViewCell.self, indexPath: indexPath)
    let item = items[indexPath.item]
    cell.configs(item)
    
    return cell
}

License

MTSDK is released under the MIT license. See LICENSE for details. My website:. Visit