EDIT: The attribute I use for swatches in the test I made is created in an UpgradeSchema.php like this:
$eavSetup->addAttribute(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'mycustomer_ip',
[
'type' => 'varchar',
'backend' => '',
'frontend' => '',
'label' => 'mycustomer_ip',
'input' => 'select',
'class' => '',
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'searchable' => false,
'filterable' => true,
'comparable' => true,
'visible_on_front' => true,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => '',
'system' => 1,
'group' => 'My Attributes Group',
'option' => array('values' => [
'',
'IP00',
'IP20',
'IP22',
'IP40',
'IP42',
'IP43',
'IP44',
'IP65',
'IP66',
'IP67',
'IP68'
])
]
);