Background: Difference in Restricted Mean Survival Time (DRMST) has attracted attention and is increasingly used in non-inferiority (NI) trials because of its superior power in detecting treatment effects compared to hazard ratio. However, when treatment switching (also known as crossover) occurs, the widely used intention-to-treat (ITT) analysis can underpower or overpower NI trials. Methods: We propose a simulation-based approach, named nifts, to calculate powers and determine the necessary sample size to achieve a desired power for non-inferiority trials that allow treatment switching, in ITT analysis using DRMST. Results: Real-world and simulated examples are used to illustrate the proposed method and examine how switching probability, switching time, the relative effectiveness of treatments, allocation ratio, and even time distribution influence powers and sample sizes. Our simulation study shows that switching time and switching probability decrease or increase powers and sample sizes compared to those in the scenarios without treatment switching. A shorter switching time and a higher switching probability amplify the magnitude of these changes. The direction of the change in powers and sample sizes depends on the relative effectiveness of the treatments. When m2/m1>1, power decreases and sample size increases, while m_2/m_1<1 leads to the opposite effect, where m1 and m2 are the median survivals in the control and experimental groups, respectively. Conclusions: This simulation-based approach offers a preview of how treatment switching can influence powers and sample sizes in NI trials, providing investigators with useful information before conducting the trials. nifts is freely available at https://github.com/cyhsuTN/nifts.