try this or else post your code then we will suggest you where you went wrong.
Block file
<?php
namespace Learning\SmartSearch\Block;
class SmartSearch extends \Magento\Framework\View\Element\Template
{
public function getTitle()
{
return "Smart Search";
}
}
etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Learning_SmartSearch" setup_version="1.0.0">
</module>
</config>
view/layout/cms_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Learning\SmartSearch\Block\SmartSearch" template="Learning_SmartSearch::html/cms.phtml"/>
</referenceContainer>
</body>
</page>
view/templates/html/cms.phtml
<h1><?php echo $block->getTitle(); ?></h1>
after creating flush cache.
I hope this will help you. If you are not getting results let me know.