Access Nextcloud from the IOS app without being connected to the same wifi

Hello everyone.
Just recently I bought a Raspberry Pi 4 and I installed Ubuntu 20 on it. After doing that I installed Nextcloud and is up and running fine. I managed to download the IOS app and Android app and link them to the Nextcloud account that I created.
Now my problem is the following:
I want to keep my Raspberry Pi 4 in my house all the time up and running, so that Nextcloud works, and I want to be able to use my Nextcloud from my IOS and Desktop app when I am in school and connected to the school wifi.
I realized that nextcloud on my IOS device or Desktop will not work if I’m not connected to the same wifi as my Raspberry Pi 4.
How can I solve this and have access to my Nextcloud while being connected to another wifi?

I guess the main “problem” you have is, that your nextcloud simply cannot be seen from the outside, as you did not take any measures to do so? If it is only running in your local network the router is basically shielding it from the open internet (out of good reasons…) and while away from home there is then no direct way to reach it.
If i am correct you are probably accessing your nextcloud using the raspis ip adress?

In principle you have to possibilities now: the simple and save one would be to simply setup a vpn to your home (quite easy, if you are using a fritz-box or another router supporting this), then connect to the vpn when away from home and access the nextcloud. This is rather a lot of effort per connection though, but spares you from actually opening your raspi to the outside world.
The more cloud-like approach would be making your nextcloud visible from the outside, meaning getting a domain for your router, forwarding ports from your router to the raspi, getting ssl encryption + certificate, … there are a bunch of how-to’s around if you google. But this also means, that your are effectively running a webserver and should be aware, that it is now exposed to the “open internet”, meaning you should be aware of the now necessary security aspects. This does especially mean regular updates, but could also include checking your configuration for possible vulnerabilities after setting it up.
I hope this was somehow helpful.