Giter Site home page Giter Site logo

dillidon / alerts-and-pickers Goto Github PK

View Code? Open in Web Editor NEW
5.6K 104.0 697.0 40.67 MB

Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...

License: MIT License

Swift 100.00%
uialertcontroller picker image-picker pickerview textfield datepicker swift uitextfield alert color-picker

alerts-and-pickers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alerts-and-pickers's Issues

Question: Date picker with custom time periods

Hey,

First of all – thanks for this awesome library!

Quick question: I’d like to create a custom data picker, where the dates are normal ones, but the time consists of only 3 values: All Day, Morning and Afternoon. Can this be achieved with the library?

Thanks!

Bug in textField with alert

I found a bug when i use oneTextField or tow
.. i try to get a text from text feild
It’s return nil so how i can fix this issue
Temporarily i use app life cycle func in OneTextfieldViewController viewWillDisappea(..){
Super...
Print(self.textField.text)
}

location picker POI tap

For the location picker can you allow users to tap te POI icons instead of only being able to just search I know the map does not have a func but it would be cool for this project.

Warning: Attempt to present UIAlertController

I have a collection view, in the footer of the collectionView I have a tableView. I'm using a protocol to have a custom cell present the pickerView. I'm getting this error whenever I press the button

PickerViewViewController.swift (line: 43) :: deinit :: has deinitialized 2018-08-01 17:45:08.675531-0700 localSelling[23104:2173373] Warning: Attempt to present <UIAlertController: 0x7ff28b850800> on <UINavigationController: 0x7ff28c00b000> whose view is not in the window hierarchy!

Silly picker logic

Picker returns a lot of params on each click/scroll action - even when it is not necessary. And in the same time it returns NOTHING on custom actions!
What if an user selects something and presses "Done" button and only thenI want to get the data? For example - when picking of the value should cause network requests.
According to your silly logic I must cache the data user selects on each scroll action and get them at the end. Of course you could provide values, index and etc properties/methods but you declared them private

Example build error in Xcode10, together with crash

Build Error:

location:

Alert&Pickers/Source/Extensions/String+Extension.swift

line 16:

return String(self[Range(start ..< end)])

Xcode said

Cannot invoke initializer for type 'Range<_>' with an argument list of type '(Range<String.Index>)'

After I modified it to the following code, the error disappeared.

let range = Range.init(uncheckedBounds: (lower: start, upper: end))    
return String(self[range])

App Crash:

When clicking Contacts Picker:

Alert&Pickers/Source/Extensions/String+Extension.swift // line 15
Thread 1: Fatal error: Can't advance past endIndex

***** 2018-07-19 02:15:39 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Country Picker

***** 2018-07-19 02:15:41 +0000 LocalePickerViewController.swift (line: 104) :: deinit :: has deinitialized

***** 2018-07-19 02:15:44 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Contacts Picker

***** 2018-07-19 02:15:44 +0000 ContactsPickerViewController.swift (line: 152) :: checkStatus(completionHandler:) :: status = CNAuthorizationStatus

How to remove unnecessary permissions

I've tried to upload my app to the app store to start the TestFlight and it got rejected and got this message

Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.

Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

I figure that your library has some calls to these functionalities since I do not use them. Is there a way to fix it, I do not want to request this access to my users

XIB instead of storyboard.

I want to use this library in my project but i am using XIB in my project so can you please do it with XIB rather then storyboard.Waiting for your responce.

[Request]UIView

Hi, is it possible to implement a custom UIView that is empty?

is it available in iPad ?

i got this error

2018-08-07 15:13:45.663030+0700 playsound[20334:1138125] Error loading /Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio:  dlopen(/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio, 262): no suitable image found.  Did find:
	/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio: mach-o, but not built for iOS simulator
2018-08-07 15:13:45.663232+0700 playsound[20334:1138125] Cannot find function pointer NewDigiCoreAudioPlugIn for factory <CFUUID 0x600000239c00> B8A063B5-2F3D-444A-88CB-D0B8F1B22042 in CFBundle/CFPlugIn 0x7fd33ff071e0 </Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin> (bundle, not loaded)
2018-08-07 15:13:46.157918+0700 playsound[20334:1138125] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7fd34400b200>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.  If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000106f731e6 __exceptionPreprocess + 294
	1   libobjc.A.dylib                     0x0000000102db8031 objc_exception_throw + 48
	2   UIKit                               0x0000000104779043 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3168
	3   UIKit                               0x0000000103c0c4f4 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2537
	4   UIKit                               0x0000000103c09c69 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 436
	5   UIKit                               0x0000000103aa04b3 _runAfterCACommitDeferredBlocks + 318
	6   UIKit                               0x0000000103a8f71e _cleanUpAfterCAFlushAndRunDeferredBlocks + 388
	7   UIKit                               0x0000000103abdea5 _afterCACommitHandler + 137
	8   CoreFoundation                      0x0000000106f15607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	9   CoreFoundation                      0x0000000106f1555e __CFRunLoopDoObservers + 430
	10  CoreFoundation                      0x0000000106ef9b81 __CFRunLoopRun + 1537
	11  CoreFoundation                      0x0000000106ef930b CFRunLoopRunSpecific + 635
	12  GraphicsServices                    0x000000010c07aa73 GSEventRunModal + 62
	13  UIKit                               0x0000000103a95057 UIApplicationMain + 159
	14  playsound                           0x00000001020680d7 main + 55
	15  libdyld.dylib                       0x0000000109ad1955 start + 1
	16  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 


my code in swift

//
//  Chapter1_25.swift
//  playsound
//
//  Created by student on 8/7/18.
//  Copyright © 2018 harvestidea. All rights reserved.
//

import UIKit
import AVFoundation
import RLBAlertsPickers

class Chapter1_25: UIViewController, AVAudioPlayerDelegate {

    var conversationSound: AVAudioPlayer = AVAudioPlayer()
    var currentColor = UIColor.black
    
    var color = UIColor.black
    
    func audioPlay() {
        
        let path = Bundle.main.path(forResource: "p4highnote.mp3", ofType: nil)!
        let url = URL(fileURLWithPath: path)
        do {
            conversationSound = try AVAudioPlayer(contentsOf: url)
            conversationSound.delegate = self
            conversationSound.play()
        } catch {
            print(error)
        }
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        audioPlay()
        
        let alert = UIAlertController(style: .actionSheet, message: "Select Country")
        alert.addLocalePicker(type: .country) { info in
            // action with selected object
        }
        alert.addAction(title: "OK", style: .cancel)
        alert.show()
        
    }
}

PhotoLibrayPicker

Can it be used for multiple selections in the same way the image picker does?

IBinspectables breaking storyboard in Xcode 9.x

I'm using Xcode 9.3 and swift 4.

The IBinspectables on every UIView is breaking my storyboard and causing a ton of issues with my project.

Why are there IBInspectables on every UIView? Seems completely unrelated the functionality of the project.

Can we remove these or make them optional? Seems far too invasive for a simple library addition.
Any feedback or help appreciated. Thanks!!

ImagePicker images from Library?

Could you suggest a way to select images from the device library while maintaining the integrity of your control?

Many thanks

Private API?

Hi,
I noticed this code users the function setValue:ForKey: which is considered private API. Other than the fact it may break in future iOS releases, does anyone know if Apple is alright with not rejecting it?

Photo Library Picker Bug / Issue

Hi folks,
when I open "Photo Library Picker" and close it before the images loaded / appears, the app crash because of deallocated picker.

Attempted to read an unowned reference but the object was already deallocated

Have anyone else this problem too?

Happy for a hint. :-)

Thread 1: Fatal error: cannot increment beyond endIndex

in the simulator works fine, but in the devices appear in this line the error:

subscript (r: Range<Int>) -> String {
    let start = index(startIndex, offsetBy: r.lowerBound)
    let end = index(startIndex, offsetBy: r.upperBound) <- Thread 1: Fatal error: cannot....
    return String(self[Range(start ..< end)])
}

UI bugs

Привет, на 7ке (наверное, и на меньших тоже) contacts picker в режиме поиска заезжает выше safe area'и, + ячейки таблицы не уезжают под search texfield, а остаются видны под ним.
Чтобы совсем красиво, стоит поставить оффсет scroll indicator'у ниже кнопки cancel.

Уменьшенные скрины

2018-02-23 23 41 47

2018-02-23 23 41 55

Issue with VerticalScrollFlowLayout

Hi,
I am using 'VegaScrollFlowLayout' class to add animation to collectionView items. This works like a charm if I use a fixed itemSize for CollectionView cell with no section header. But If I use any (section header or dynamic itemSize). The CollectionView displayed item with some weird way.
I face these 2 issues while using this class:

  1. When adding section header, and use default FlowLayout. Everything works well. When using 'VerticalScrollFlowLayout', Section Header doesn't display anymore.

  2. If use 'estimatedItemSize' instead of 'itemSize' for dynamic item size. The animation doesn't work properly.
    Let me know If you can help me on this.
    Thanks

Support iOS9

Thanks. It is nice ideas which provide better UX for Picker in iOS.
Can you support iOS 9.0 and above?

AlertController with textfield not showing

Hi,

Thank you for making this beautiful library available for developpers.
Actually I am trying to use the One TextField Picker, but the alert is not showing and I am getting this error: Attempt to present <UIAlertController: 0x7fa2b21d2400> on <Project.SplashViewController: 0x7fa2b140c560> whose view is not in the window hierarchy!

When I add self.present(alert, animated: true, completion: nil) before alert.show() to solve the problem I am getting another exception: Application tried to present modally an active controller

Did I miss something? Can you help me please

Thank you.

Storyboard?

This is a superb control! Perhaps you could add an example using a Storyboard? I have a large project, where Alerts-Pickers would need to be incorporated.

Conflict source

Your lib is great 👍
But it include a lot of view extensions file attached cause conflict with exist extensions in project. I think you should wrap your lib to use it more convenience. Thanks.

Reasons for minimum target iOS 11?

Hello, Thanks for this Marvelous library.

Can you tell the reason, why we require to set minimum target to iOS 11?

And, the Alert/ActionSheet are default one? with modified?

Introduction

How can I describe the source file after putting it in the application?
For example, how would you describe how to implement this simple one?
2018-02-17 14 56 21
It is pretty rudimentary content, but please tell me..

TextField crash

The TextField needs to be in the window heirarchy in order for it not to crash

Error: init(coder:) has not been implemented"

App works fine when this is in app delegate:
window?.rootViewController = UINavigationController(rootViewController: ViewController())

When it's not and I try to present it, I get these errors:

  1. Fatal error: init(coder:) has not been implemented

  2. Warning: Attempt to present <UIAlertController: 0x108839200> on <MainVC: 0x105055e00> whose view is not in the window hierarchy!

webview in alert

I want add a vebview in alert,
let title = "Privacy Policy"
let message = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)

        let subview = alert.view.subviews.first
        let bgview = subview?.subviews.first
        bgview?.backgroundColor = UIColor(red: 255, green: 255, blue: 255)
        bgview?.layer.cornerRadius = 10
        print(alert.view.frame.size.width)

        alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: nil))
        alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
        
        
        
        let web = UIWebView(frame: CGRect(x: 0, y: 50, width: alert.view.bounds.size.width * 0.7, height: self.view.frame.size.height * 0.70 - 95))

        let requestURL = NSURL(string: "http://google.com");
        let request = NSURLRequest(url: requestURL! as URL);
        web.loadRequest(request as URLRequest);
        
        web.scalesPageToFit = true
        web.loadRequest(request as URLRequest)
        alert.view.addSubview(web)
        
        self.present(alert, animated: true)

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.