oursky / arcms Goto Github PK
View Code? Open in Web Editor NEWiOS ARKit demo with Skygaer as the cloud store of 3D models
iOS ARKit demo with Skygaer as the cloud store of 3D models
Current VODownloader flow are hidden in the chain of completion callback. It makes the code difficult to follow. i.e. you need to go through 5 function in details starting from the public function downloadVirtualObject
to know how is the download works.
A better way is to write flow control logic in one function, and keep the actual download logic spread in those function. In your case, there is actually 3 async request. We don't need to separate those codes into 5 async function.
In additional, the download is sequential, which is not necessary.
So please take a look at https://developer.apple.com/documentation/dispatch/dispatchgroup
In result, you will have following code:
self.downloadJSON(url: url, completion: { urls in
if !urls["textures"] {
print("Fail to download \(texture)")
completion(false)
}
allDownload = DispatchGroup()
self.downloadTextures(url: urls["textures"], dispatchGroup: allDownload, completion: { success in
if !success {
print("Fail to download \(texture)")
completion(false)
}
})
self.downloadSCN(url: urls["scn"], completion: { success in
if !success {
print("Fail to download \(texture)")
completion(false)
}
})
allDownload.notify(queue: .main){
completion(true)
}
})
And I found there is various non-symmetry API design. For example, there is removeFromLoading
not no addToLoading
. addToLoading
are do in-line.
Please add the following to .gitignore:
*.pem
*.cert
*.pfx
*.key
.env
docker-compose.override.yml
We should have a configurable cache size and persist the files into disk.
{url: 'xxxx'}
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.