How to write platform-specific code in the ts-file? So code that is only valid for ios and code that is only valid for android? How can I determine whether the device runs ios or android as operating system?
I use Ionic 4+ with Capacitor and Angular.
Many thanks in advance!
You can use Platform to detect OS.
import { Platform } from '@ionic/angular';
@Component({...})
export class MyPage {
constructor(public platform: Platform) {
if(platform.is('ios')){
//ios logic
}
}
}