Well, this question is partly theoretic, partly philosophic or subjective. Since I am not a professional composer, I see myself too unable to give the theoretic aspects. I give you my vision and on solely melody and share my own experiences. Melody is much more my cup of tea than harmony, since I play a melodic instrument. Of course, it depends on what kind of melody you want to compose: do you want to write a classical Mozart melody or more in the style of Milhaud or Lady Gaga (de gustibus disputandum). Furthermore, what emotions does the melody have to contain?
Melody
Fortunately, I have melodies playing in my head. The only thing I have to do is to write them down. However, some of these are better than others. What I noticed is that the following aspects help to create stable, good melodies.
Decide the scale or a certain set of notes / intervals.
For me it helps to write down the scale / mode or the set of notes / intervals before I start composing. I hear a big difference between A major and Eb major, so it helps me to already 'get into the mood' of the melody that I want to write down.
Sing!
When I compose, I sing. Especially when I am composing tonal music, which is easier to sing than atonal music. When you, as a composer, have trouble with singing the just composed melody, you may need to look at it again. A general rule for me: the easier the melody can be sung, the easier it can be remembered, the better the melody.
Rhythm
Next to pitch, rhythm is a basic element of melody. Singing or playing the rhythms with a pencil can help to create compact rhythms.
Unity and balance
*This will I edit tomorrow, due to lack of time right now.*
In conclusion: for both melody and harmony applies that practice is the best way to composing easier and faster. Try to compose every day and you will see that it becomes easier.
I hope this helps!
Maarten