Yes, as long as the online casino obtains a Swiss license. From the 1st of January 2019 onwards, online casino licenses came available in Switzerland. Physical casino establishments were able to apply for a license extension that allows them to offer games online as well.
Offshore casinos in Switzerland are considered to be illegal and blocked by the government. View blocklist.