Preheat your air fryer to 320°F (160°C). Grease and line a 6-inch round cake pan (or mini loaf pans) with parchment paper.
In a large bowl, whisk together flour, sugar, baking soda, baking powder, salt, cinnamon, and nutmeg.
Slowly fold in eggs, oil, vanilla extract, grated carrots, and crushed pineapple. If desired, add chopped pecans and shredded coconut. Mix until just combined.
Pour the batter into the prepared pan, filling it about 3/4 full. Tap the pan gently on the counter to release air bubbles.
Place the pan into the air fryer and bake at 320°F (160°C) for 30-35 minutes, or until a toothpick inserted into the center comes out clean.
Let the cake cool in the pan for 10 minutes, then remove it from the pan and allow it to cool completely on a wire rack.
Beat the softened cream cheese and butter until smooth. Gradually add powdered sugar, vanilla extract, and a pinch of salt, continuing to beat until fluffy.
Once the cake has cooled completely, spread the frosting evenly over the top. Garnish with extra chopped pecans or coconut, if desired.