The little I know about this war makes it seem like it was a war of unprecedented viciousness and brutality, fought to defend British economic interests, where the British won a crushing victory, and then granted the Union of South Africa independence just a few years later.
I you were able to clarify which Boer War you were interested in, I could provide a better answer.
I assume from the context clues you are referring to the 2nd Boer War from 1899-1902
So lets set some things up.
From Brits landing and taking Ownership of the Cape Colony, the relationship between Afrikaners/Boer and the Brits has been adversarial at best.
The ZAR was founded explicitly to be rid of British rule. The Voertrekkers felt forced out by the British at the Cape, and again in Natal. Even in the Orange Free State, society was far more British than Afrikaans(Hermann Gilliomee, The Afrikaners: Biography of a People).
The Gold Rush and explosion of Johannesburg change things. The British see far more value in South Africa than just a port of passage to India. The Boers become increasingly paranoid and distrustful of the British as they both demographic shifts with the importing of primarily Mozambiquan and African labour to undercut South African labour.
So this is where we come to in 1899.
So the Boer War starts with an event known as the Jameson Raid. In short Cecil Rhodes wanted a unified South Africa, so with the colonial administration, he has L.S Jameson stage a coup in Johannesburg, with the hope that it will start a revolt and spread to Pretoria.(Gilliomee) It doesn't work, it makes Rhodes look like a backstabber and he loses his identity as a friend to Afrikaners. Kruger and M.T. Steyn(who was a nationalist leader in the OSF), along with Jan Smuts prepare for war, meanwhile relationships with mining magnates and the British government become abysmal as there is now no trust following the Jameson Raid. Brits are forced to fight a guerrilla war, eventually going full scorched earth and concentration camps, which does very little for the good will of the Boer.
Britain wins. Rhodes vision of a unified South Africa happens. The loss is greatly lamented. Jan Smuts writes to Abraham Fischer(grandfather of Bram Fischer): There are years of great danger ahead before us, partly because people have fallen so deep, so fathomlessly deep, into poverty and misery, partly because everything will be done by the other side, through their education system, and otherwise, to anglicise the generation now growing up
It is in this post-Boer War reality that Afrikaner Nationalism and Apartheid really start to develop. Instead of sitting idly by Afrikaans schools are founded, and a large part of the ideology they espoused was about eiesoortigheid -own-ness. This creates the nationalism that is seen in Apartheid(Erich Louw, The Rise, Fall, and Legacy of Apartheid)
Fast foward to 1909, South Africa is unified and declared "indepented" in name only, but certainly not in practice. And Then World War 1 happens. Smuts sought reconcilliation and peace between Anglo and Boer. Hertzog and other nationalist would not accept compromise to Anglo-septicism. Smuts was willing to, in the spirit of reconciliation allow South Africa to enter the First World War, the Nationalists were against this for obvious reasons. It was not an Afrikaner war, it was a Anglo war. By the end of the war, Smuts now a great statesman, would be a key contributor to the Balfour Declaration which founds the commonwhealth. South Africa gets increased sovreignty now. Partially because Britain is flat broke after WW1, and does not want to be burdened by certain colonies(mainly white dominated ones like Canada and South Africa) by 1926.
Basically Britain was faced by an exceptionally strong nationalism in South Africa, the attempts at Anglocization were failed. For example the governor Milner wanted to use Rugby and sport to anglicize the population. Well rugby became the Afrikaner sport by 1910(Douglas Booth, The Race Game: Sport and Politics in South Africa). South Africa because it was white controlled, like Canada, Australia and New Zealand, was given a bit more leeway, and with the strain of WW1, Britain is forced to give up some of the holding and relent to nationalism, especially in the case of South Africa when Hertzog and the National Party mainted control of parliament through the 1920s. To be clear though, what was put in place in 1910 by the South Africa Act was not independence or British forfieture. It was unionisation and consolidation to a central South African Government, that was still very much second to the whims of Britain.