Git Product home page Git Product logo

hgplaceholders's People

Contributors

blashkin avatar hamzaghazouani avatar idomo avatar jamchen avatar jjson avatar m7md3elwan avatar monkeywithacupcake avatar rizwankce avatar

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

hgplaceholders's Issues

'Placeholder' is ambiguous for type lookup in this context

'The type Method is declared in two imported modules. You have to specify the module from which to use the type. Use Alamofire.Method instead of Method' in one stackoverflow answer. I cannot related struct Placeholder with HGPlaceholders. I also use Kingfisher library which has Placeholder struct in it.

Loved your library, keep going!

HGPlaceholder + Custom collection view layout == ?

When i use your library on UICollection view with custom layout, after removing all items, i got crash here:
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { return cache[indexPath.item] }
But, on method prepare, i always clean my cache.

Helps only invalidation collection view layout after reloadData()

Action button is not visible, but tapping on the white space is printing logs.

Hi,

I played around the example project and found that the placeholder has a button "try again", and user can tap that.

However in my project, there is no action button, but I can tap on the white space below the subtitle and the log is printing "Placeholder action button tapped"

How and where do I set the action button to visible?

Thanks

Update podspec version

Installed via Cocoapods:

pod 'HGPlaceholders'

for swift 4.2: this causes compile errors.

I see that these have been fixed in the repo, but not for Cocoapods.

In order to install a version compatible with Swift 4.2 I have to install as such:

pod 'HGPlaceholders', :git => 'https://github.com/HamzaGhazouani/HGPlaceholders.git'

Cocoapods looks at the latest commit at the time it gets submitted and uses that commit to install from for that version. Since you haven't submitted a new version to Cocoapods, even though you have made new commits for 4.2 compatibility, I have to install use the git url.

Please update when you have the time.

Error EXC_BAD_ACCESS (code=2, address=...)

Hey!

I'm new to iOS development. And I found this plugin very interesting, so I want to implement it. But I stumble upon a problem that I cannot resolve.

My code like looks like this:

...
import HGPlaceholders

class MyViewController: BaseViewController {

    @IBOutlet var myTableView: TableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        ...
        
        configureTableView()
        
        ...
    }
}

extension MyViewController: UITableViewDelegate, UITableViewDataSource {
    func configureTableView() {
        myTableView.delegate = self
        myTableView.dataSource = self
        myTableView.placeholderDelegate = self     // <- ERROR: EXC_BAD_ACCESS (code=2, address=0x1b4b2ec80)
        
        ..
        
        myTableView.register(UINib(nibName: "MyCell", bundle: nil), forCellReuseIdentifier: "MyItemCell")
        
        ...
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        ...
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        ...
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        myTableView.deselectRow(at: indexPath, animated: true)
        myTableView.showLoadingPlaceholder()
    }
}

I got an error EXC_BAD_ACCESS (code=2, address=0x1b4b2ec80) at the line myTableView.placeholderDelegate = self.

Can someone help me?

Thank you

Thank you!

I've used a lot of third party libraries, and only your issue is 0. You're awesome!

How do I change placeholder's title and subtitle when I am calling showNoConnectionPlaceholder() and others?

I have a simple question, sorry for being a ios newbie.

How do I change the title and sub title wording as I am displaying the placeholders?

I found out that the wordings are in PlaceholderData.swift, in public struct PlaceholderData.

Lets say I do not wish to hard code them here, but set it to something when I am calling tableView.showNoConnectionPlaceholder(), how do I do it?

I also found the file PlaceholdersProvider.swift, which I set it to be :

var noConnectionData: PlaceholderData = .noConnection
        noConnectionData.image = #imageLiteral(resourceName: "hg_default-error")
        noConnectionData.title = "Testing no connection title"
        noConnectionData.subtitle = "Testing no connection sub title"
        let noConnection = Placeholder(data: noConnectionData, style: commonStyle, key: .noConnectionKey)

But the message is still the same

How do I do it?

Thanks

actionButtonTappedFor is now working i need help, please!

Hi everyones, i am facing an issue in which i am not able to excute an action after tapping the button on "ShowNoResultsPlacelhoder()", i already set as delegate , and i want to excute an action when the user taps on: Try Again.
Please help.

Placeholders not showing

Hey I'm writing the follow code on my tableView

`
import UIKit
import HGPlaceholders

class SentMemesTVC: UITableViewController{

var placeholderTableView: TableView?

var memes = [Meme]()

override func viewDidLoad() {
    super.viewDidLoad()
    self.clearsSelectionOnViewWillAppear = false
    
    reloadTable()
  
    NotificationCenter.default.addObserver(self, selector: #selector(reloadTable), name: NSNotification.Name(rawValue: NOTIF_RELOAD_TABLE), object: nil)
    
    
    
    placeholderTableView = tableView as? TableView
    placeholderTableView?.placeholderDelegate = self as PlaceholderDelegate
    
    
    placeholderTableView?.placeholdersProvider = .basic
    placeholderTableView?.showErrorPlaceholder()
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == TO_MEME_EDITOR{
        if let memeEditor = segue.destination as? MemeMainVC{
            if let meme = sender as? Meme{
                memeEditor.meme = meme
            }
        }
    }
}

override func numberOfSections(in tableView: UITableView) -> Int {
    return 1
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return memes.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if let cell = tableView.dequeueReusableCell(withIdentifier: "MemeTableCell", for: indexPath) as? MemeTableCell{
        let memeCell = memes[indexPath.row]
        cell.configureCell(meme: memeCell)
        return cell
    }
    return UITableViewCell()
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let meme: Meme = memes[indexPath.row]
    performSegue(withIdentifier: TO_MEME_EDITOR, sender: meme)
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    return 114
}

@objc func reloadTable(){
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    memes = appDelegate.memes
    self.tableView.reloadData()
}

@IBAction func toMemeEditor(_ sender: Any){
    performSegue(withIdentifier: TO_MEME_EDITOR, sender: nil)
}

}

extension SentMemesTVC: PlaceholderDelegate {

func view(_ view: Any, actionButtonTappedFor placeholder: Placeholder) {
    print(placeholder.key.value)
    placeholderTableView?.showDefault()
}

}

`

but nothing is happening

Could not cast value of type 'UITableView' to 'HGPlaceholders.TableView'

The cast for me does not work: The error appears here:

placeholderTableView = notificationTableView as! TableView

I am not using a UITableViewController, but just a UITableview in a UIViewController.

I follow the demo project and create the placeholderTableView as my UITableView (notificationTableView) as TableView.
Force Cast creates the following issue:
Could not cast value of type 'UITableView' to 'HGPlaceholders.TableView'

Optional cast with ? does not do anything.

Editing mode

Editing mode is weak point here

As placeholder is cell it is editable by default

Placeholder is ambiguous for type lookup in this context

'The type Method is declared in two imported modules. You have to specify the module from which to use the type. Use Alamofire.Method instead of Method' in one stackoverflow answer. I cannot related struct Placeholder with HGPlaceholders. I also use Kingfisher library which has Placeholder struct in it.

Loved your library, keep going!

[Suggestion] The placeholders should not disable the scrolling functionality?

Hi @HamzaGhazouani,

I was thinking whether it would be nice to have the option to choose whether the placeholders should disable the scrolling functionalities of UITableViews and UICollectionViews.

One good example why I think that sometimes we need to have that one enabled is let's say you want to check for new data by triggering a pull to refresh action. Currently, if an empty state is visible, there is no way you can trigger this action, since the scrolling is disabled.

What are your thoughts on this?

Best regards,
Sasho

Archiving project fails when using HGPlaceholders as a Pod

Hey @HamzaGhazouani,

I have discovered that if you try to archive the project for distribution (AdHoc), and at the same time you have added and are using this library as a Pod, the archiving fails with an error:

Symbol(s) not found for architecture arm64

I have also verified that this is not a case when the library is added to the project manually.

Please take a look and if you need some additional info, please let me know.

Cheers,
Sasho

CocoaPods 1.5.0 support for static libraries

Hey @HamzaGhazouani,

I have updated CocoaPods to v.1.5.0 and tried building the dependencies as static libraries. The pod update command succeeded, however, when building the application, I get the following errors for HGPlaceholders:

Unable to run command 'StripNIB PlaceholderCollectionViewCell.nib' - this target might include its own product.
Unable to run command 'StripNIB PlaceholderCollectionViewCell~iphone.nib' - this target might include its own product.
Unable to run command 'StripNIB PlaceholderCollectionViewCell~ipad.nib' - this target might include its own product.
Unable to run command 'StripNIB PlaceholderTableViewCell.nib' - this target might include its own product.
Unable to run command 'StripNIB PlaceholderTableViewCell~iphone.nib' - this target might include its own product.
Unable to run command 'StripNIB PlaceholderTableViewCell~ipad.nib' - this target might include its own product.

Could you please take a look?

Cheers,
Sasho

collectionView as? CustomCollectionView == nil ????

hello everyone, why i print placeholderCollectionView is nil ? i use code to create the collectionview like:

class CustomCollectionView: CollectionView {
    override func customSetup() {
        placeholdersProvider = .custom
    }
}
class vc: UICollectionViewController {
   var placeholderCollectionView: CustomCollectionView? {
        return collectionView as? CustomCollectionView
    }
}

Archive Fails

Hi,

I was trying to archive a project using this library, but... fails...

Attached an image error..

screen shot 2017-09-18 at 12 02 30 pm

how can I fix this?

Custom Title HGPlaceholders

I have a very big app and do not want to make a placeholder for each screen I would like to provide context to about what is loading. (And also do not want a general 'loading' message). Is there currently a way to change the title/subtitle easily for each ViewController, from the ViewController itself?

Individually call button action (actionButtonTappedFor)

I implemented the follwing logic to call up button actions individually.

Do you have any better ideas?

public protocol CustomPlaceholderDelegate: PlaceholderDelegate {
    func noResultButtonTapped(_ view: Any, placeholder: Placeholder)
    func loadingButtonTapped(_ view: Any, placeholder: Placeholder)
    func errorButtonTapped(_ view: Any, placeholder: Placeholder)
    func noConnectionButonTapped(_ view: Any, placeholder: Placeholder)
}

extension CustomPlaceholderDelegate {
    public func view(_ view: Any, actionButtonTappedFor placeholder: Placeholder) {
        switch placeholder.key {
        case .noResultsKey: noResultButtonTapped(view, placeholder: placeholder)
        case .loadingKey: loadingButtonTapped(view, placeholder: placeholder)
        case .errorKey: errorButtonTapped(view, placeholder: placeholder)
        case .noConnectionKey: noConnectionButonTapped(view, placeholder: placeholder)
        default: break
        }
    }
}
extension ViewController: CustomPlaceholderDelegate {
    func noResultButtonTapped(_ view: Any, placeholder: Placeholder) {
        print("No result tapped")
    }
    
    func loadingButtonTapped(_ view: Any, placeholder: Placeholder) {
        print("Loading button tapped")
    }
    
    func errorButtonTapped(_ view: Any, placeholder: Placeholder) {
        print("Error button tapped")
    }
    
    func noConnectionButonTapped(_ view: Any, placeholder: Placeholder) {
        print("No connection button tapped")
    }
}

Assertion on demo application when selecting custom placeholdersProvider

Launch example
Go to table view tab
Select an another settings like Default2

Code executed

self.placeholderTableView?.placeholdersProvider = .default2
self.placeholderTableView?.reloadData()

The table content is static so no change.
Maybe you want to make table model dynamic according to the placeholdersProvider elements.
Maybe the placeholder in PlaceholdersProvider must be accessible

Then clic on the last table cell like, starwars or xib
In PlaceholdersShowing.showCustomPlaceholder(with

assertionFailure("Your placeholdersProvider is not configured correctly, no placeholder with key: \(key.value) found!")

Crash in CollectionView.swift on line 153

Hi @HamzaGhazouani,

I have noticed a strange crash that sometimes happens when switching between data sources. I cannot provide the exact steps on how to reproduce the issue, but I am sending you a stacktrace that might be of help. I also know (by setting an Exception breakpoint) that the crash occurs in the CollectionView.swift file on line 153.

Please take a look and let me know your findings.

# Platform: ios
# OS Version: 11.2.6 (15D100)
# Device: iPhone X

#0. Crashed: com.apple.main-thread
0  UIKit                          0x18d013660 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 248
1  UIKit                          0x18da40fc4 -[UICollectionView _setCollectionViewLayout:animated:isInteractive:completion:animator:] + 2216
2  UIKit                          0x18d11a9a4 -[UICollectionView _setCollectionViewLayout:animated:isInteractive:completion:] + 84
3  UIKit                          0x18d11a930 -[UICollectionView setCollectionViewLayout:] + 392
4  HGPlaceholders                 0x1014f49e0 specialized CollectionView.collectionViewLayout.setter (CollectionView.swift)
5  HGPlaceholders                 0x1014f388c @objc CollectionView.collectionViewLayout.setter (CollectionView.swift)
6  HGPlaceholders                 0x1014f48d4 specialized CollectionView.switchTo(dataSource : UICollectionViewDataSource?, delegate : UICollectionViewDelegate?) -> () (CollectionView.swift:159)
7  HGPlaceholders                 0x1014f45e0 CollectionView.reloadData() -> () (CollectionView.swift:86)
8  HGPlaceholders                 0x1014f4624 @objc CollectionView.reloadData() -> () (CollectionView.swift)
9  AppName                      0x100f7c310 SearchCalendarsViewController.(bindViewModel() -> ()).(closure #1).(closure #1) (SearchCalendarsViewController.swift:46)
10 AppName                      0x100eab9dc specialized SearchCalendarsViewModel.(searchCalendars(term : String?, restartSearch : Bool, completion : ([IndexPath]?) -> ()) -> ()).(closure #1) (SearchCalendarsViewModel.swift:102)
11 AppName                      0x100eab2bc partial apply for SearchCalendarsViewModel.(searchCalendars(term : String?, restartSearch : Bool, completion : ([IndexPath]?) -> ()) -> ()).(closure #1) (SearchCalendarsViewModel.swift)
12 AppName                      0x100e76384 thunk (ChooseCalendarViewModel.swift)
13 AppName                      0x100eab34c partial apply for thunk (SearchCalendarsViewModel.swift)
14 PromiseKit                     0x1017942d0 specialized Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift:153)
15 PromiseKit                     0x10178d730 Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift)
16 PromiseKit                     0x101797074 partial apply for Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift)
17 PromiseKit                     0x1017a32e8 specialized State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift:51)
18 PromiseKit                     0x101798454 State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift)
19 PromiseKit                     0x1017a6b38 partial apply for State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift)
20 PromiseKit                     0x1017b335c specialized (contain_zalgo<A> (DispatchQueue, rejecter : (Resolution<A>) -> (), block : () throws -> ()) -> ()).(closure #1) (Zalgo.swift:78)
21 PromiseKit                     0x1017b32e0 (contain_zalgo<A> (DispatchQueue, rejecter : (Resolution<A>) -> (), block : () throws -> ()) -> ()).(closure #1) (Zalgo.swift)
22 PromiseKit                     0x1017738e4 thunk (after.swift)
23 libdispatch.dylib              0x183376a54 _dispatch_call_block_and_release + 24
24 libdispatch.dylib              0x183376a14 _dispatch_client_callout + 16
25 libdispatch.dylib              0x1833b7c80 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 968
26 CoreFoundation                 0x18399f344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
27 CoreFoundation                 0x18399cf20 __CFRunLoopRun + 2012
28 CoreFoundation                 0x1838bcc58 CFRunLoopRunSpecific + 436
29 GraphicsServices               0x185768f84 GSEventRunModal + 100
30 UIKit                          0x18d0155c4 UIApplicationMain + 236
31 AppName                      0x100e49830 main (UICollectionViewCell+Utils.swift:12)
32 libdyld.dylib                  0x1833dc56c start + 4

--

#0. Crashed: com.apple.main-thread
0  UIKit                          0x18d013660 -[UICollectionViewData layoutAttributesForItemAtIndexPath:] + 248
1  UIKit                          0x18da40fc4 -[UICollectionView _setCollectionViewLayout:animated:isInteractive:completion:animator:] + 2216
2  UIKit                          0x18d11a9a4 -[UICollectionView _setCollectionViewLayout:animated:isInteractive:completion:] + 84
3  UIKit                          0x18d11a930 -[UICollectionView setCollectionViewLayout:] + 392
4  HGPlaceholders                 0x1014f49e0 specialized CollectionView.collectionViewLayout.setter (CollectionView.swift)
5  HGPlaceholders                 0x1014f388c @objc CollectionView.collectionViewLayout.setter (CollectionView.swift)
6  HGPlaceholders                 0x1014f48d4 specialized CollectionView.switchTo(dataSource : UICollectionViewDataSource?, delegate : UICollectionViewDelegate?) -> () (CollectionView.swift:159)
7  HGPlaceholders                 0x1014f45e0 CollectionView.reloadData() -> () (CollectionView.swift:86)
8  HGPlaceholders                 0x1014f4624 @objc CollectionView.reloadData() -> () (CollectionView.swift)
9  AppName                      0x100f7c310 SearchCalendarsViewController.(bindViewModel() -> ()).(closure #1).(closure #1) (SearchCalendarsViewController.swift:46)
10 AppName                      0x100eab9dc specialized SearchCalendarsViewModel.(searchCalendars(term : String?, restartSearch : Bool, completion : ([IndexPath]?) -> ()) -> ()).(closure #1) (SearchCalendarsViewModel.swift:102)
11 AppName                      0x100eab2bc partial apply for SearchCalendarsViewModel.(searchCalendars(term : String?, restartSearch : Bool, completion : ([IndexPath]?) -> ()) -> ()).(closure #1) (SearchCalendarsViewModel.swift)
12 AppName                      0x100e76384 thunk (ChooseCalendarViewModel.swift)
13 AppName                      0x100eab34c partial apply for thunk (SearchCalendarsViewModel.swift)
14 PromiseKit                     0x1017942d0 specialized Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift:153)
15 PromiseKit                     0x10178d730 Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift)
16 PromiseKit                     0x101797074 partial apply for Promise.(then<A> (on : DispatchQueue, execute : (A) throws -> A1) -> Promise<A1>).(closure #1).(closure #1) (Promise.swift)
17 PromiseKit                     0x1017a32e8 specialized State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift:51)
18 PromiseKit                     0x101798454 State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift)
19 PromiseKit                     0x1017a6b38 partial apply for State.(then<A> (on : DispatchQueue, else : (Resolution<A1>) -> (), execute : (A) throws -> ()) -> ()).(closure #1).(closure #1) (State.swift)
20 PromiseKit                     0x1017b335c specialized (contain_zalgo<A> (DispatchQueue, rejecter : (Resolution<A>) -> (), block : () throws -> ()) -> ()).(closure #1) (Zalgo.swift:78)
21 PromiseKit                     0x1017b32e0 (contain_zalgo<A> (DispatchQueue, rejecter : (Resolution<A>) -> (), block : () throws -> ()) -> ()).(closure #1) (Zalgo.swift)
22 PromiseKit                     0x1017738e4 thunk (after.swift)
23 libdispatch.dylib              0x183376a54 _dispatch_call_block_and_release + 24
24 libdispatch.dylib              0x183376a14 _dispatch_client_callout + 16
25 libdispatch.dylib              0x1833b7c80 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 968
26 CoreFoundation                 0x18399f344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
27 CoreFoundation                 0x18399cf20 __CFRunLoopRun + 2012
28 CoreFoundation                 0x1838bcc58 CFRunLoopRunSpecific + 436
29 GraphicsServices               0x185768f84 GSEventRunModal + 100
30 UIKit                          0x18d0155c4 UIApplicationMain + 236
31 AppName                      0x100e49830 main (UICollectionViewCell+Utils.swift:12)
32 libdyld.dylib                  0x1833dc56c start + 4

#1. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1834eb568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1834eb3e0 mach_msg + 72
2  CoreFoundation                 0x18399f108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x18399ccd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x1838bcc58 CFRunLoopRunSpecific + 436
5  Foundation                     0x1842f1594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x1843109ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7  UIKit                          0x18db7f7a8 -[UIEventFetcher threadMain] + 136
8  Foundation                     0x1843f30f4 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x1836202b4 _pthread_body + 308
10 libsystem_pthread.dylib        0x183620180 _pthread_body + 310
11 libsystem_pthread.dylib        0x18361eb74 thread_start + 4

#2. com.twitter.crashlytics.ios.MachExceptionServer
0  AppName                      0x100fa638c CLSProcessRecordAllThreads (CLSProcess.c:376)
1  AppName                      0x100fa638c CLSProcessRecordAllThreads (CLSProcess.c:376)
2  AppName                      0x100fa623c CLSProcessRecordAllThreads (CLSProcess.c:407)
3  AppName                      0x100f95870 CLSHandler (CLSHandler.m:26)
4  AppName                      0x100f9088c CLSMachExceptionServer (CLSMachException.c:446)
5  libsystem_pthread.dylib        0x1836202b4 _pthread_body + 308
6  libsystem_pthread.dylib        0x183620180 _pthread_body + 310
7  libsystem_pthread.dylib        0x18361eb74 thread_start + 4

#3. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1834eb568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1834eb3e0 mach_msg + 72
2  CoreFoundation                 0x18399f108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x18399ccd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x1838bcc58 CFRunLoopRunSpecific + 436
5  CFNetwork                      0x1841abb08 -[__CoreSchedulingSetRunnable runForever] + 780
6  Foundation                     0x1843f30f4 __NSThread__start__ + 996
7  libsystem_pthread.dylib        0x1836202b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x183620180 _pthread_body + 310
9  libsystem_pthread.dylib        0x18361eb74 thread_start + 4

#4. AVAudioSession Notify Thread
0  libsystem_kernel.dylib         0x1834eb568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1834eb3e0 mach_msg + 72
2  CoreFoundation                 0x18399f108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x18399ccd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x1838bcc58 CFRunLoopRunSpecific + 436
5  AVFAudio                       0x189225cd4 GenericRunLoopThread::Entry(void*) + 164
6  AVFAudio                       0x189250740 CAPThread::Entry(CAPThread*) + 84
7  libsystem_pthread.dylib        0x1836202b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x183620180 _pthread_body + 310
9  libsystem_pthread.dylib        0x18361eb74 thread_start + 4

#5. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361f080 _pthread_wqthread + 1288
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

#6. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361eeec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

#7. Thread
0  libsystem_pthread.dylib        0x18361eb68 start_wqthread + 122

#8. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361f080 _pthread_wqthread + 1288
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

#9. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361eeec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

#10. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361f080 _pthread_wqthread + 1288
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

#11. Thread
0  libsystem_kernel.dylib         0x18350cd80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18361eeec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x18361eb6c start_wqthread + 4

Looking forward to hearing from you and once again, thanks for this awesome library!

Cheers,
Sasho

custom action button

Are there any way to change action button with own custom button ? Or do you have any plan ?

Unable to add custom placeholder

1- I created a utility class and assign it to the table view where I needed to use table view placeholder.
2- created a variable in VC "var placeholderTableView: TableView?"
3- In setup GUI
self.placeholderTableView?.placeholdersProvider = .default
self.placeholderTableView?.placeholdersProvider.add(placeholders: TableViewPlaceholder.createPlaceholder1())
4- it show default placeholder not custom placeholder which i setting

Cell are not removing after view controllers deallocation.

Thanks for grate framework.
I found this issue when my collection view as well as tableview get deallocated then also cell of respective list are not removed from memory. I try to set collection view and tableview nil and removed from super view also in deinit method.
I have attached screenshot which is demo on which i also tried.
Thanks again😊🙂👍
screen shot 2018-08-31 at 12 08 24 pm

不能和 RxSwift 一起使用

placeholderTableView = tableView as? TableView
placeholderTableView?.tableFooterView = UIView()
placeholderTableView?.placeholderDelegate = self
placeholderTableView?.dataSource = nil
placeholderTableView?.placeholdersProvider = .default
placeholderTableView?.showNoResultsPlaceholder()
placeholderTableView?.reloadData()

// 使用 Rx 配置 tableView 数据时崩溃,似乎是已存在 dataSource 的问题。
viewModel.data.asObservable().share().bind(to:
    tableView.rx.items(cellIdentifier: "Cell")
) { (row, model, cell) in
    cell.textLabel?.text = model.oper_name
}.disposed(by: viewModel.bag)

如何解决?

Multi-Section have some question

If TableView has multiple section, but the rows in each section is 0, I want to show the data of the section header, but it still shows placeHolder-noResultDataView now.

Please help me~

PlaceholderData Image Not Animated for CollectionView

    // animate the cell
    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        
        if placeholder.style?.isAnimated == false {
            return
        }
        
        guard let placeholderTableViewCell = cell as? PlaceholderTableViewCell else { return }
        animate(cell: placeholderTableViewCell)
    }

Tableview has the above to animate the image but there is not one for CollectionView

How can I use this?

I want to use this for my project.
when I import HGPlaceholders.then set
var placeholderTableView: TableView?
placeholderTableView = self.tableView as? TableView
But The placeholderTableView is nil.
How can I fix this?
Thank you.

Keep search bar visible after displaying placeholder

I have a search bar in my tableview which refreshes the content as the user types but if the search query is not found the "NoResultsPlaceholder" is shown and the search bar is automatically hidden, is there a way to make the placeholder show below the search bar?

My search bar is added to the table with this: self.tableView.tableHeaderView = UISearchBar()

Crashing on changing orientation while UISearchController is active

Hi,
I tried using your library, it's looking very nice, but has a little problem when changing the device orientation while the navigationItem.searchController.isActive = true.
This is the error I'm getting in the console:

*** Assertion failure in -[HGPlaceholders.TableView _classicHeightForRowAtIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3698.84.16/UITableView.m:15329
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid row height provided by table delegate. Value must be at least 0.0, or UITableViewAutomaticDimension.'

After some debugging I'v noticed that the hight from the delegate is -119:
image
So I tried the most obvious thing, I'v added tableViewHeight = tableViewHeight >= 0.0 ? tableViewHeight : UITableView.automaticDimension before the method return (line 154), but guess what?
Somehow the value is still -119 😓
So I thought maybe the UITableView.automaticDimension is also returning -119? so let's try just tableViewHeight = 0.
No, it didn't worked, tableViewHeight was still -119. 😧

Hope you'll be able to reproduce and detect how to solve this problem.
I didn't understand yet how is that possible to change the value by this way (tableViewHeight = 0) and it won't change, like this line doesn't exists. 😨

Thanks,
Ido.

UITableView header/footer views are not preserved if set programmatically

Hey @HamzaGhazouani,

I have also discovered that if you have let's say a footer added to the UITableView (one common example is adding a blank UIView inside viewDidLoad (e.g. tableView.tableFooterView = UIView() to the table view's footer view in order to remove the separators if there are only 1 or 2 rows in the table view) which has been added programmatically in viewDidLoad for example, for some reason, the footer view is removed and set to nil.

This is not the case if you have added it via Storyboard.

Could you please take a look?

Cheers,
Sasho

Pod not found

Can't find pod while installing -

Unable to find a specification for HGPlaceholders

how do I set "tableView.separatorStyle = .none

Hello everyone,
how do I set tableView.separatorStyle = .none?
Because when the placeholderTableView?. ShowLoadingPlaceholder() is hidden and the table is reloaded, it returns to own singleLines.

Crash on iOS 9+ when used within UICollectionView

Hi @HamzaGhazouani,

Good job on this awesome library! I love it!

I have noticed that a crash occurs on iOS 9.x (tested on iOS 9.3.5) if you use HGPlaceholders for a UICollectionView that has a header and/or footer. You can reproduce this issue by simply running your latest Example project (that you have pushed ~2 hours ago).

The issue is related to not updating the defaultLayout with the proper layout after the dataSource changes.

Could you please take a look?

Also, I think it is also wise to declare the PlaceholderCollectionViewCell as open, since this is already the case for PlaceholderTableViewCell. I think most devs would like to subclass it eventually.

Looking forward to your feedback. Keep up the good work!

Cheers,
Sasho

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.