First, I used the code of the following:
But, the copied file is not shown in iCloud Drive and
I found that iCloud capability must be checked in Xcode project's Capabilities tab.
But I also found that the Apple Developer Program membership is needed to develop iCloud apps. See the following page:
.
.
.
And the other references to be useful for the future:
maybe the following is about iCloud storage, not iCloud Drive