To automatically offload apps, go to Settings > App Store > Offload Unused Apps. To manually offload apps, go to Settings > General > iPhone Storage > Offload Unused Apps. To reinstall an offloaded app, tap on the app icon to download it again.