Giter Club home page Giter Club logo

pickerviewkit's Introduction

Hi there, I'm Christian πŸ‘‹

Buy me a β˜• coffee if you want to support me 😎

pickerviewkit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pickerviewkit's Issues

General help

Hello, I have a VPN app, I currently have only 1 server that is not user configurable. I define the IP by specifying: let serverAddress = "192.168.1.2" (Not actual ip)

I would like to add multiple servers using PickerView.

eg.
A picker view where you scroll through: UK1, UK2, US1,US2,GER1,Ger2 etc. but I don't know how to not only assign a value to each of those IE UK1=88.99.22.11 Uk2= 88.21.33.11 US1=56.32.12.23
ETC.

But then also parse the value (88.99.22.11) to let serverAddress =

Could you help me :)

If Rows do not provide a model they will not be passed to the delegate

If you use a multiColumn configuration with default PickerViewRow-Models they will not be passed to the delegate.

This is because the default PickerViewRow does not need a model and just rows with actual models will be passed to selectedRowModels.

func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent column: Int) {
        guard let columns = dataSource?.columns else {
            return
        }
        
        if validate(column: column, row: row) {
			let numberOfColumns = pickerView.numberOfComponents
			var selectedRowModels: [PickerViewRowModelProtocol] = []
			if numberOfColumns > 0 {
				for columnIndex in (0...numberOfColumns-1) {
					let selectedRowIndex = pickerView.selectedRow(inComponent: columnIndex)
					let row = columns[columnIndex].rows[selectedRowIndex]
					// HERE IS THE PROBLEM, IF THERE IS NO MODEL IT WONT BE APPENDED
                                         if let rowModel = row.model {
						selectedRowModels.append(rowModel)
					}
				}
			}
			let rowModels: [PickerViewRowModelProtocol]? = selectedRowModels.isEmpty ? nil : selectedRowModels
            let currentRowModel = columns[column].rows[row]
			callback?.didSelectRow(self, in: pickerView, row: currentRowModel, rowModels: rowModels)
        } else {
            return
        }
    }

I think it would be a great idea to give the PickerViewRow a default model if it will be initalized with just a type.

Suggestions

  1. The protocol name of PickerViewDelegateCallbackProtocol is confusing. Try to find a better name.
  2. Add a computed property to the PickerViewManager to get the currently selected row models.
  3. Optimize the PickerViewRowModelProtocol
  4. I don't like managers. Please call it PickerViewService.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.