This is a very useful property of hom-functor.
Let C be a category, then its hom-functor can be wrote as
HomC:Cop×C→Sets
If the limit limXi exists in C, then for all Y∈Ob(C) there is a natural isomorphism
HomC(Y,ilimXi)≃ilim(HomC(Y,Xi))
If the colimit colimiXi exists in C, then for all Y∈Ob(C) there is a natural isomorphism
HomC(colimiXi,Y)≃ilim(HomC(Xi,Y))
See nLab for more details.