Reordering Courses in a Queue |

This is a companion discussion topic for the original entry at

@pasanpr, when I select more than 3 courses in section fatal error occurs:
***** Assertion failure in -[_UIDiffableDataSourceUpdate initWithIdentifiers:sectionIdentifiers:action:desinationIdentifier:relativePosition:destinationIsSection:], /BuildRoot/Library/Caches/**

2020-01-14 02:13:26.802124+0500 RWLibrary[12794:3641984] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Fatal: supplied identifiers are not unique.’

Also both in your code and in mine lesson in queue list does not come first after pressing play button - it comes second.

Please help to find out what’s happening.

There is an issue with the way the gradient is done. Once the app is loaded and you press the Home button and then go back into the app, there seems to be some kind of cumulative effect.


(I was not allowed to post more than one image. The first one looks exactly as expected).


Simulator Screen Shot - iPhone 11 Pro - 2020-02-06 at 08.48.01

I first noticed the effect when scrolling around but it is highly recreatable just leaving and going back in.

@andreysvx Apologies on the delay in getting back to you I somehow missed this! Were you able to solve this issue?

Thanks for uncovering this! The issue occurs because in GradientView.swift the gradient is being created and applied inside layoutSubviews(), which is called repeatedly when the app comes into foreground (or when the device is rotated).

The fix is fairly simple. On line 43 in GradientView.swift an instance of CAGradientLayer() is created. If you move this line of code outside the method to create a reference to the gradient the issue should be resolved!

1 Like

No problem) Unfortunately I have not managed to solve nor this neither other issues.=(


I have faced this issue
‘NSInternalInconsistencyException’, reason: 'Fatal: supplied identifiers are not unique.

After confirming Identifiable it is resolved

And resolved via below link:

Please guide me if it is wrong

Your solution works so great job at that :+1: There’s most likely a missing identifier in the starter file that’s causing this issue. I will double check!

@andreysvx Do you still have issues with this?

Yes, still have issues with it =(

@pasanpr Can you please help with this when you get a chance? Thank you - much appreciated! :]

I guess url in Video may repeat → identifier(we use 【url】in Video.swift) not unique

create an identifier using uuid solve this

let identifier = UUID().uuidString

static func ==(lhs: Video, rhs: Video) -> Bool {
    return lhs.identifier == rhs.identifier

@ys_xs Thank you for sharing your solution - much appreciated!