After you build the Gamification Mobile SDK for iOS, you can customize the game zone UI components.
The game zone UI components are available in the LoyaltyMobileSDK-iOS/SampleApps/MyNTORewards/MyNTORewards/GameZone package.
Spinner Customization
Customize the spinner components, such as the wheel size, frame width and color, wheel segments, spin button, and more in the FortuneWheelView.swift file. Here are all the parameters you can modify.
For example, to change the spin wheel outer frame width and height, open the LoyaltyMobileSDK-iOS/SampleApps/MyNTORewards/MyNTORewards/GameZone/Views/FortuneWheel/FortuneWheelView.swift file in Xcode, and replace Circle() frame(width: 316, height: 316) with Circle() frame(width: 300, height: 300).
To change the spin button background color to blue, open the LoyaltyMobileSDK-iOS/SampleApps/MyNTORewards/MyNTORewards/Misc/Color.swift file, and inside the ColorTheme structure, replace let wheelIndicatorBackground = Color("wheelIndicatorBackgroundColor") // #23475F with let wheelIndicatorBackground = Color.blue.
Scratch Card Customization
You can customize the scratch card components, such as the box, canvas, wrapper text, and more in the ScratchCanvasView.kt file. Here are all the properties you can customize:
1private var backButton: some View {2 HStack {3 Button {4 // Invalidating the timer to avoid unintended navigation because of the timer5 timer?.invalidate()6 dismiss()7 } label: {8 Image("ic-backarrow")9 }10 .padding(.leading, 20)11 .padding(.bottom, 10)12 .frame(width: 30, height: 30)1314 Spacer()15 }16 }1718 private var titleView: some View {19 VStack(spacing: 10) {20 Text(gameDefinitionModel?.name ?? StringConstants.Gamification.scratchCardTitleLabel)21 .font(.gameHeaderTitle)22 Text(gameDefinitionModel?.description ?? StringConstants.Gamification.scratchCardSubTitleLabel)23 .font(.gameHeaderSubTitle)24 }25 .padding(30)26 }2728 private var loadingView: some View {29 Text("Loading...")30 .foregroundStyle(.white)31 .font(.system(size: 24))32 .fontWeight(.bold)33 .frame(width: cardSize.width, height: cardSize.height)34 .background(Color.theme.accent)35 }3637 private var rewardText: some View {38 Text(playGameViewModel.playedGameRewards?.first?.name ?? "--")39 .font(.largeTitle)40 .bold()41 .foregroundStyle(.white)42 .frame(width: cardSize.width, height: cardSize.height)43 .background(Color.theme.accent)44 .zIndex(finishedScratching ? 10 : 0)45 }4647 private var scratchCardWrapperText: some View {48 Text(String(repeating: (StringConstants.Gamification.scratchCardLabel), count: 70))49 .font(Font.scratchText)50 .multilineTextAlignment(.center)51 .foregroundColor(Color.theme.scratchCardText)52 .rotationEffect(Angle(degrees: -45))53 .mask {54 Rectangle()55 .frame(width: cardSize.width, height: cardSize.height)56 .cornerRadius(10)57 .opacity(finishedScratching ? 0 : 1)58 }59 .opacity(finishedScratching ? 0 : 1)60 }6162 private var scratchCardContentView: some View {63 ZStack {64 // Purple background with postage stamp border65 DottedBorderRectangle(width: backgroundSize.width,66 height: backgroundSize.height,67 color: Color.theme.accent)6869 // Grey scratch card70 Rectangle()71 .fill(Color.theme.scratchCardBackground)72 .frame(width: cardSize.width, height: cardSize.height)73 .cornerRadius(10)74 .opacity(finishedScratching ? 0 : 1)7576 // Text overlay77 scratchCardWrapperText78 }79 }8081 private var scratchCardGame: some View {82 ScratchCardGame(cursorSize: 30, cardSize: cardSize, gameModel: gameDefinitionModel, onFinish: $finishedScratching) {83 scratchCardContentView84 } overlayView: {85 // Reward text86 switch playGameViewModel.state {87 case .loaded:88 rewardText89 default:90 loadingView91 }92 }93 .animation(.linear(duration: 0.5), value: playGameViewModel.state)94 .environmentObject(playGameViewModel)95 }9697 private var descriptionView: some View {98 VStack(spacing: 20) {99 Text((StringConstants.Gamification.scratchCardBodyLabel))100 .font(.gameDescText)101 .multilineTextAlignment(.center)102 .frame(width: 258)103 }104 }105}
For example, to change the angle of the scratch card wrapper text inside the gray box, open the LoyaltyMobileSDK-iOS/SampleApps/MyNTORewards/MyNTORewards/GameZone/Views/ScrachCard/ScratchCardView.swift file in Xcode, and replace rotationEffect(Angle(degrees: -45)) with rotationEffect(Angle(degrees: -25)) . To change the number of times the text appears inside the gray box, replace Text(String(repeating: (StringConstants.Gamification.scratchCardLabel), count: 70)) with Text(String(repeating: (StringConstants.Gamification.scratchCardLabel), count: 50)) .