hamzaghazouani / hgplaceholders Goto Github PK
View Code? Open in Web Editor NEWNice library to show placeholders and Empty States for any UITableView/UICollectionView in your project
License: MIT License
Nice library to show placeholders and Empty States for any UITableView/UICollectionView in your project
License: MIT License
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
I've used a lot of third party libraries, and only your issue is 0. You're awesome!
Hi @HamzaGhazouani,
I am thinking whether adding new properties for setting a custom font for the title, subtitle and action title to the PlaceholderStyle
struct is something you have considered also?
I find that this will be helpful to a lot of developers that are going to be using this library.
Any thoughts?
Cheers!
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
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
I have created a custom view but calling button click does not work
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 UITableView
s and UICollectionView
s.
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
I have 3 UICollectionViews in a UIViewController
can't get this to work at all
Never mind, I figured it out!
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()
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?
refresh control not working with Placeholder
Can't find pod while installing -
Unable to find a specification for
HGPlaceholders
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!")
// 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
Im not sure how to configure a custom cell.. I get the error above. and for the life of me cant figure out as to why!
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
:
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.
'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!
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.
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.
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
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.
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
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
Is there any way to add a custom placeholder without using XIBs?
Is this implemented?
Are you interested in this kind of feature?
Thank you so much!
Please update to support Swift 4.2.
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.
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
Editing mode is weak point here
As placeholder is cell it is editable by default
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😊🙂👍
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.
marcosgriselli/Sizes#25
I have the same issue but with this pod. Here is an example how did they fix that:
marcosgriselli/Sizes@ab7105a
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
Thanks for the great library.
I had one question that how do I set the dynamic title and subtitle which is received from server api?
Please help me with this.
UICollectionView: collectionView from XIB -> collectionView as? CollectionView = nil ???
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~
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
}
}
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
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)
如何解决?
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")
}
}
Are there any way to change action button with own custom button ? Or do you have any plan ?
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
'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!
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()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.