- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
Eureka Rows
        Mohamad Kaakati edited this page Sep 26, 2018 
        ·
        2 revisions
      
    form +++ Section("Login Form")
    <<< TextRow() { $0.placeholder = "Username" }
    <<< PasswordRow() { $0.placeholder = "Password" }
    <<< ButtonRow() {
        $0.title = "Login"
        $0.onCellSelection { cell, row in
            self.presentAlert(message: "Will login")
        }form +++ Section("Multiple Choices")
    <<< MultipleSelectorRow<String>() {
        $0.title = "Favourite Foods"
        $0.options = ["π", "π", "π", "π"]
        $0.value = ["π", "π" ]
    }<<< SwitchRow("switchRowTag"){
    $0.title = "Show message"
    }
    
<<< LabelRow(){
    $0.hidden = Condition.function(["switchRowTag"], { form in
        return !((form.rowBy(tag: "switchRowTag") as? SwitchRow)?.value ?? false)
    })
    $0.title = "Switch is on!"+++ Section("Section2")
<<< DateRow(){
    $0.title = "Date Row"
    $0.value = NSDate(timeIntervalSinceReferenceDate: 0) as Date
    }<<< PhoneRow(){
    $0.title = "Phone Row"
    $0.placeholder = "And numbers here"
    }<<< SegmentedRow<String>("gender"){
    $0.options = ["male", "female"]
    $0.title = "m"
    $0.value = "f"
    }.onChange{ row in
        print(row.value)
    }form +++ Section("Section1")
    <<< TextRow(){ row in
        row.title = "Text Row"
        row.placeholder = "Enter text here"
}// Section
+++ Section() {
   $0.header = HeaderFooterView<UIView>(HeaderFooterProvider.class)
   $0.header?.height = { CGFloat.leastNormalMagnitude }
   }Adding more than one SelectableSection<ListCheckRow<String>> will require unique tag identifier for each.
form
    +++
    SelectableSection<ListCheckRow<String>>("Where did you travel?", selectionType: .multipleSelection){section in
        section.tag = Int(arc4random_uniform(9999999)).string // Unique Random Tag Identifer
}
let singleItems = ["Netherlands", "France", "Lebanon", "Cyprus"]
for option in singleItems {
    form.last! <<< ListCheckRow<String>(option){ listRow in
        listRow.title = option
        listRow.selectableValue = option
        listRow.value = nil
    }
}Adding more than one SelectableSection<ListCheckRow<String>> will require unique tag identifier for each.
form
    +++
    SelectableSection<ListCheckRow<String>>("Single Selection?", selectionType: .singleSelection(enableDeselection: true)){section in
        section.tag = Int(arc4random_uniform(9999999)).string // Unique Random Tag Identifer
}
let singleItems2 = ["Netherlands", "France", "Lebanon", "Cyprus"]
for option in singleItems2 {
    form.last! <<< ListCheckRow<String>(){ listRow in
        listRow.tag = Int(arc4random_uniform(9999999)).string
        listRow.title = option
        listRow.selectableValue = option
        listRow.value = nil
    }
}https://github.com/EurekaCommunity/ViewRow
form
    +++ Section() {
        $0.header = HeaderFooterView<UIView>(HeaderFooterProvider.class)
        $0.header?.height = { CGFloat.leastNormalMagnitude }
    }
    <<< ViewRow<UIView>() { (row) in
        
        }
        .cellSetup { (cell, row) in
            //  Construct the view - in this instance the a rudimentry view created here
            cell.view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 210))
            cell.view!.backgroundColor = .white
            
            let imageContainer = UIImageView()
            cell.view!.addSubview(imageContainer)
            
            imageContainer.contentMode = .scaleAspectFill
            imageContainer.clipsToBounds = true
            imageContainer.anchor(top: cell.view!.topAnchor, left: cell.view!.leftAnchor, bottom: cell.view!.bottomAnchor, right: cell.view!.rightAnchor, topConstant: 0, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 210)
            imageContainer.image = UIImage(named: "") // Set Image Name
            
            cell.viewRightMargin = 0
            cell.viewLeftMargin = 0
            cell.viewTopMargin = 0
            cell.viewBottomMargin = 0
            cell.update()
        }