Combine apples, sugar, water, cranberries, and vinegar in a large saucepan; bring to a boil. Reduce heat and simmer until cranberries begin to break down, about 20 minutes. Stir walnuts, ginger, and nutmeg into apple mixture; cook until apples are tender and flavors of relish have blended, 10 to 15 more minutes. Pour relish into jars and cool to room temperature before covering with lids. Refrigerate.