Writers often use nature in their works to construct or convey meaning. How is such use important to establish the themes of Sonnet XVIII?
"Shall I compare thee to a summer's day?" is the rhetorical question of Sonnet XVIII. With the juxtaposition of the beauty of Nature against the beauty of the beloved about whom the poet writes, the beloved is "more lovely and more temperate" than the summer that often suffers from a sun that burns "too hot", as well as the "Rough winds [that] do shake the darling buds of May."
Of course, as is true of all that is temporal, "every fair from fair sometime[s] declines," as seasons change, flowers die, and death comes to everything and everyone. By contrast with the ephemeral quality of all of Nature, the beloved's beauty will endure forever in the "eternal lines" of verse.
The comparison of the beloved to Nature provides the poet a measure of his love that proves everlasting as it is recorded in a Petrarchan sonnet, and, thus, impervious to the ravages of time that Nature suffers; it remains uncorrupted, that in Nature are subjected to mutability.