Man annoyed at his phone and computer.GaudiLab | iStock | Getty ImagesYou might sometimes receive spam text messages on your iPhone. They can be really difficult to permanently block, since spammers can use multiple numbers to keep getting messages into your iPhone’s inbox. But Apple has a trick that sorts those messages outside of your main iMessage inbox so that they’re a little less annoying.Your spam messages might look like this:Spam message on an iPhone.CNBCIf you turn the feature on, you’ll see all of the text messages from people in your address book in one place, and all of the messages from unknown senders, including spam or text messages from people who aren’t in your address book, in a separate column.The feature isn’t new, but I didn’t know about it until a colleague asked me how to block spam messages this morning. So, here’s how to set it up:Open Settings on your iPhone.Tap Messages.Turn on the feature under “Message Filtering” called “Filter Unknown Senders.”Now, when you receive a text message from someone you don’t know, they’ll appear in a separate tab of your inbox like this:You can sort out unknown messages, including spam, on your iPhone.Todd Haselton | CNBCIt’ll help clear out the clutter from the important conversations in your inbox. If you want to try blocking each number individually, just do this:Tap on the message.Tap the number at the top of the screen.Select the “Info” button.Tap the number again.Choose “Block this Caller.”You can also tap the “Report Junk” button in spam messages, but this doesn’t block someone. It just sends information about the spammer to Apple, which might help prevent future spamming.