President Donald Trump's visit to Apple's Texas manufacturing plant represents a truce in the White House war on Silicon Valley and an unlikely "bromance" with chief executive Tim Cook.

The visit will give the US leader a chance to hail American manufacturing and step back, at least temporarily, from his tirade against big technology firms.

Apple announced in September it would keep making its Mac Pro computer in the United States, after obtaining tariff exemptions for some components in the high-end computers.

The developments show an unusual Trump-Cook relationship in sharp contrast with the president's attacks on other tech giants.

"On the face of it, it's an unlikely relationship," said Roger Kay, analyst at Endpoint Technologies Associates who follows the sector.

Cook, who supported Democrat Hillary Clinton in 2016, has been able to sidestep much of Trump's anger by being "very diplomatic," Kay said.

"He's not saying 'I love Trump,' but he's not saying 'I hate Trump,'" said Kay.

Apple CEO Tim Cook, seen here at a meeting of the American Workforce Policy Advisory Board at the White House, has reportedly worked with the president's daughter Ivanka (R) and her husband Jared Kushner to keep communication channels open
Apple CEO Tim Cook, seen here at a meeting of the American Workforce Policy Advisory Board at the White House, has reportedly worked with the president's daughter Ivanka (R) and her husband Jared Kushner to keep communication channels open AFP / SAUL LOEB

"He hasn't made any disparaging public comments. By not ruffling Trump's feathers he's gotten quite a lot out of it."

Cook and Trump remain far apart on a number of issues including trade and immigration, with Apple opposing the White House plan to end protection for so-called "dreamers" who came to the US as children.

While Apple has acknowledged it has paid some tariffs imposed by Trump on goods imported from China, the iPhone maker has so far avoided a major impact from the trade friction.

Trump, who has called Google and social media firms "biased" and been especially critical of Amazon CEO Jeff Bezos -- accusing him of using his personal investment in the Washington Post for politics -- has had mostly praise for the Apple CEO.

"Other companies hire very expensive consultants," Trump said in August. "But the only one who calls me is Tim Cook. He calls me whenever there's a problem."

Apple CEO Tim Cook has managed to avoid criticism from President Donald Trump while keeping open discussions on tariffs and American manufacturing
Following news of a potential $150 hike on the price of iPhones, Apple avoided the anticipated 15 percent tariff as the US and China reportedly reached a trade deal. AFP / Angela Weiss

Trump, who once referred to the CEO as "Tim Apple," appears to be forging a friendly relationship with Cook even when he offers criticism.

In one tweet, he seemed to fret over the design of the latest iPhones which no longer have a home button.

"To Tim: The Button on the IPhone was FAR better than the Swipe!" Trump wrote.

According to the Wall Street Journal, Cook has quietly cultivated his relationship with Trump through the president's daughter Ivanka and her husband Jared Kushner, both of whom advise the president.

Trump appears to have softened some of his positions on tariffs after hearing Cook's argument that punishing Apple would help foreign rivals such as Samsung.

"Tim Cook has gone out of his way it seems to develop a relationship with President Trump because he was concerned I'm sure of the potential impact on the business" from Trump's policies, said Bob O'Donnell of Technalysis Research.

Because most of Apple products are manufactured in China, "there was a potentially large impact on profitability," O'Donnell said.

"Tim Cook is trying to be pragmatic and trying to address the issue by tackling it head on."

Apple, which benefited from legislation signed by Trump that reduced taxes on repatriated profits from 35 to 15 percent, has responded to White House efforts by pledging to invest $350 billion in the US economy by 2023 through its own manufacturing and from suppliers.

O'Donnell said that Cook's efforts to forge a relationship with Trump has some risks as well in Silicon Valley, where the president is unpopular.

"I think some people who are Apple fans and don't like Trump find it a little disconcerting," O'Donnell said.

Kay said however that Apple employees and customers understand the needs of the business, and that Cook's efforts might even ease some of the tensions between the White House and the tech industry.

"Maybe Tim can create a rosier halo around Silicon Valley," Kay said.

"If he puts a human face on Silicon Valley, it could give Trump a slightly different view."