As I wandered through my gardens on a steamy August afternoon, I paused to admire a beautiful black swallowtail butterfly floating among the flowers.

As I wandered through my gardens on a steamy August afternoon, I paused to admire a beautiful black swallowtail butterfly floating among the flowers. Moments later, it perched on a clump of bronze fennel in my herb garden, depositing a solitary translucent egg barely the size of a pinhead on the delicate ferny foliage.

Closer inspection revealed multiple eggs clinging to the wispy strands in addition to several minute, almost indiscernible caterpillars. In the weeks to come, a few of these tiny chewing machines with orange spots and a white saddle will mature, molting multiple times to produce bright green and black-striped larvae with yellow dots.

For some gardeners, the knowledge that a favored plant was about to be devoured by caterpillars would be distressing, but this was a happy discovery for this enthusiastic butterfly gardener, since I cultivate this plant both for its attractive licorice-scented leaves and as caterpillar food.

Since early childhood, I have had a perpetual fascination with wildlife and flowers, spending hours exploring the woodlands, meadows and gardens that surrounded our Catskill Mountain home. It was this fondness for nature and my desire to garden that inspired us to purchase our current property more than 30 years ago. Bordered by a naturally existing brook, it became my mission to transform a barren builder’s lot, nearly devoid of trees and vegetation, into a wildlife-friendly habitat with special emphasis on plantings for magical butterflies and hummingbirds.   For a landscape to serve as an effective wildlife habitat, it must provide nature’s basic needs of food, water, shelter and reproductive areas. An ideal habitat for butterflies and hummers should include a multi-layered environment with a progression of nectar-rich flowers in sunny open spaces bordered by small trees and shrubs, hedgerows or thickets that will offer shelter from bad weather and predators and provide nesting sites for the hummers.   A water source is also essential and may be provided by water gardens, birdbaths or practically any container that holds water. Add stones, small branches or gravel to create landing platforms and provide shallow water for these tiny creatures. Hummingbirds will also gravitate to oscillating sprinklers or fountains to bathe or take an occasional sip of water.   A varied habitat highlighted by plantings of boldly colored flowers is sure to catch the attention of butterflies and hummingbirds passing overhead. Mass plantings of colorful flowers, particularly those tinted pink and lavender, are irresistible to butterflies. Compound flowers and especially daisy-like, composite flowers invite numerous butterfly species, their petals providing ideal platforms from which to sip the nectar found in the myriad of tiny flowers forming the central disk.   Warm temperatures are essential for butterflies to be active, with the summer months being peak time for observing a profusion of “fluttering flowers,” as Robert Frost described these ethereal creatures.   Red, orange and hot-pink tubular flowers tend to be most seductive to hovering hummers as many of these elongated blossoms contain plentiful nectar at the base of their tubes. Only one species, the ruby-throated hummingbird, inhabits our eastern gardens, usually returning from its tropical winter home at the end of April or in early May.   Early-blooming plants that provide nectar for both butterflies and hummingbirds include lilacs, rhododendrons, azaleas, viburnums and columbines. Candytuft, dandelions and ox-eye daisies are early favorites for the butterflies while hummers enjoy quince, beauty bush (Kolkwitzia), Weigela, honeysuckle, lungworts (Pulmonaria) and coral bells.   Hummingbird feeders with commercial mixtures or sugar water (1 part sugar combined with 4 parts water) can be used to supplement flower nectar. Hang feeders out of the wind, preferably in midday and afternoon shade, as the sugar solution is very susceptible to mold, bacteria and fermentation during hot weather, which can be harmful and even deadly to these delightful creatures.   As the summer progresses and temperatures rise, activity increases with many more flowers to entice these special winged visitors. Numerous plants are equally effective for attracting both butterflies and hummingbirds including butterfly bushes, catmint, salvia, lilies, beebalm, phlox, verbena, zinnias, dahlias, lantana and pentas.   Purple coneflowers (Echinacea), Liatris and fall-blooming sedums and asters are irresistible magnets for butterflies; Shasta daisies, Stokesia, Heliopsis, butterfly weed (Asclepias), yarrow (Achillea), Scabiosa, daylilies, Coreopsis, Rudbeckia, Gaillardia, Joe-Pye-weed and cosmos tempt numerous species. Fuchsia, million bells and Rose-of Sharon are potent lures for hummers in addition to trumpet vine, geraniums, impatiens, petunias, nasturtiums, cardinal flower (Lobelia), cannas, Penstemons and hosta flowers.   Perhaps the most overlooked aspect of creating a successful butterfly garden is the provision of larval food sources, for without caterpillars there are no butterflies, and many species only travel a few hundred yards from where they hatch. Native plants, including pussy willow, spicebush, viburnum, poplar, cherry, birch, aster, milkweed, thistle, violets, clover, plantain and Queen Anne’s Lace set apart from more formal beds may be the best solution for accommodating chewing larvae.   In the perennial borders, cultivated plants that sustain caterpillars include members of the carrot family (fennel, dill and parsley), in addition to artemisia, globe thistle, yarrow, licorice plant and snapdragons. While these plants may be temporarily chewed, most recover once the caterpillars wander off to form the pupal stage.   It should be noted that it is the caterpillars of moths that tend to be most destructive, often hatching in large numbers and completely defoliating our plants. The majority of butterflies lay their eggs singly or a few at a time causing considerably less damage.   Be sure to take time on these warm, sunny summer days to stroll through the garden and look for butterflies and hummingbirds among the flowers. You will be delighted by their magical presence.   Suzanne Mahler is an avid gardener, photographer and lecturer who has been developing the 1.5-acre property surrounding her home in Hanover, Mass., for more than 30 years. She is a member of two local garden clubs, past President of the New England Daylily Society, an overseer for the Massachusetts Horticultural Society and is employed at two garden centers.