If you were using HFS+ TRIM command would work! But when using APFS TRIM is already enabled, Apple does it within the file system.
[quote|format=featured]On APFS, macOS automatically performs a TRIM operation on the free disk space on boot via the AFPS Space Manager (spaceman). Therefore, as long as TRIM is enabled on the system (via ``trimforce`` for 3rd-party SSDs, see karolus's answer), you don't have to worry about it. There is no command and no need to manually trim the unused blocks.[/quote]