Yes you can but you need to make sure the water in their tank has a GH around 200ppm and a pH above 7.0.
Some more info livebearers (guppies, platies, swordtails, mollies).
In the wild, female livebearers hang out in large groups consisting of between 20 & 50 (but sometimes up to 100 or more) females. These groups have a pecking order with the biggest most dominant female ruling the group and she has a group of girlfriends who back her up. All the other females live in the group but are lower down the pecking order.
The groups of females move around rivers and waterways looking for food and places to hang out. As the groups move around a few males follow the group and try to breed with any females. The groups of males have a pecking order too and the biggest male will bully his smaller mates.
In the confines of an aquarium, the males will constantly harass the females and try to breed with them. This puts undue stress on the females and if there are too many males constantly pestering the females, the females can get sick and die.
It is preferable to keep livebearers in single sex tanks (either male or female but not both sexes together). If you want a group of males and females then have 1 male and at least 6 females (preferably 10 or more females per male).
Female livebearers can carry up to 6 sperm packets from breeding with males and they use 1 sperm packet to fertilise each batch of eggs. The gestation period (from the time she fertilises the eggs to when she gives birth to free swimming babies) is about 1 month. After which she will fertilise another batch of eggs using another sperm packet. This allows female livebearers to produce young about once a month for up to 6 months without any males being present.
If you want to breed livebearers for specific colours, then have a tank with females and let them give birth and use up all the sperm packets they are carrying in their body. Give them a few months without being pregnant and then add a male to the tank for a week before moving him out, or move the female/s into a tank with a male for a week and let them breed. Then move the females back into their own tank.