# How to include \index{} in new command (custom macro)?

When I try to used \index{} inside of \newcommand, the entry is made in the index, however, the text no longer appears in the body. How can I achieve a macro for the \index command?

\documentclass[12pt]{article}
\usepackage{fontspec}

\newcommand{\myentry}[1]{This is an #1}

\begin{document}
\myentry{Apple}

\end{document}


typesets:

\documentclass[12pt]{article}
\usepackage{fontspec}

\usepackage{makeidx}
\makeindex
\newcommand{\myentry}[1]{This is an \index{#1}}

\begin{document}
\myentry{Apple}
\printindex
\end{document}


typesets:

-

Since \index merely passes information to be indexed and actually does not print anything, use
\newcommand{\md}[1]{This is an \index{#1}#1}

which prints the command after passing it to \index.